MCPcopy
hub / github.com/lmorg/murex / cmdTabulate

Function cmdTabulate

builtins/core/tabulate/tabulate.go:75–342  ·  view source on GitHub ↗
(p *lang.Process)

Source from the content-addressed store, hash-verified

73}
74
75func cmdTabulate(p *lang.Process) error {
76 f, _, err := p.Parameters.ParseFlags(
77 &parameters.Arguments{
78 Flags: flags,
79 AllowAdditional: false,
80 },
81 )
82
83 if err != nil {
84 return err
85 }
86
87 var (
88 separator = constSeparator
89 splitComma bool
90 splitSpace bool
91 keyIncHint bool
92 keyVal = false
93 joiner = " "
94 columnWraps = false
95 colWrapsBuf string // buffer for wrapped columns
96 keys []string
97 w writer
98 last string
99 split []string
100 //iKeyStart int // where the key starts when column wraps and keyVal used
101 processKey bool
102 //iValStart int // where the value starts when column wraps and keyVal used
103 )
104
105 for flag, value := range f.GetMap() {
106 switch flag {
107 case fSeparator:
108 separator = value.(string)
109 case fSplitComma:
110 splitComma = true
111 case fSplitSpace:
112 splitSpace = true
113 case fKeyIncHint:
114 keyIncHint = true
115 case fKeyVal:
116 keyVal = true
117 case fJoiner:
118 joiner = value.(string)
119 case fMap:
120 keyVal = true
121 case fColumnWraps:
122 columnWraps = true
123 case fHelp:
124 return help(p)
125 }
126 }
127
128 if splitSpace && splitComma {
129 return fmt.Errorf("cannot have %s and %s both enabled. Please pick one or the other", fSplitComma, fSplitSpace)
130 }
131
132 if !keyVal && keyIncHint {

Callers

nothing calls this directly

Calls 14

helpFunction · 0.85
newMapWriterFunction · 0.85
stripKeyHintFunction · 0.85
ParseFlagsMethod · 0.80
GetMapMethod · 0.80
ErrIfNotAMethodMethod · 0.80
SetDataTypeMethod · 0.65
GetDataTypeMethod · 0.65
StringMethod · 0.65
BooleanMethod · 0.65
GetValueMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected