(p *lang.Process)
| 73 | } |
| 74 | |
| 75 | func cmdTabulate(p *lang.Process) error { |
| 76 | f, _, err := p.Parameters.ParseFlags( |
| 77 | ¶meters.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 { |
nothing calls this directly
no test coverage detected