Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align expected flag data type #856

Closed
pjebs opened this issue May 2, 2019 · 5 comments · May be fixed by spf13/pflag#383
Closed

align expected flag data type #856

pjebs opened this issue May 2, 2019 · 5 comments · May be fixed by spf13/pflag#383

Comments

@pjebs
Copy link

pjebs commented May 2, 2019

Flags:
  -d, --date-range strings   date range (using input csv time format) (default [,])
  -f, --fields strings       csv field names (separated by comma) (default [timestamp,value])
  -h, --help                 help for csv
      --itf string           input csv time format (ref: https://golang.org/pkg/time/#pkg-constants) (default "2006-01-02")
      --order-by string      order by "ASC" or "DESC"
      --otf string           output csv time format (ref: https://golang.org/pkg/time/#pkg-constants) (default "2006-01-02")
  -o, --out string           output file name (default "export.csv")
  -s, --store int            store identifier (1-1115) (default 698)

it would be good if cobra aligned the expected flag data types for flags.

@github-actions
Copy link

github-actions bot commented Apr 6, 2020

This issue is being marked as stale due to a long period of inactivity

@johnSchnake
Copy link
Collaborator

Is this really a problem? I checked a few other tools I had locally and none of them aligned that as a separate column. I think by keeping the data type by the flag itself it makes it more readable too; the idea of an aligned column would be useful if that data would be useful to read on its own but just a column of string string int string doesn't add much value.

Since this is almost 3y old I'm going to close as part of #1600; if you want to discuss further feel free to reopen.

@avamsi
Copy link

avamsi commented Sep 9, 2023

@johnSchnake would you be open to reviewing a PR for this? For me, it's not much about the data type (although it could be helpful to quickly scan that too), but it makes it easier to quickly scan the flag names (same reason we have the help text aligned).

@avamsi
Copy link

avamsi commented Sep 9, 2023

@marckhouzam as they seem to be more active (aside: I created https://github.com/avamsi/climate, which heavily uses Cobra under the hood, so would love to help maintain Cobra).

@avamsi
Copy link

avamsi commented Sep 9, 2023

For posterity, I was looking at the fix anyway and it needs to be to spf13/pflag (whose last commit is more than 2 years old?!) -- https://github.com/spf13/pflag/blob/d5e0c0615acee7028e1e2740a11102313be88de1/flag.go#L723-L749.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants