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

Ban usage of positional arguments #1562

Closed
dpc opened this issue Jan 31, 2023 · 3 comments · Fixed by #2085 or #2133
Closed

Ban usage of positional arguments #1562

dpc opened this issue Jan 31, 2023 · 3 comments · Fixed by #2085 or #2133
Labels
cli good first issue Good for newcomers

Comments

@dpc
Copy link
Contributor

dpc commented Jan 31, 2023

When working with real software positional arguments are very inconvenient.

  • They are not self describing, so it's just harder to read and understand them.
  • When messed up by the user the feedback is poor, as it's hard to determine which thing exactly is missing and where.
  • (when available) shell autocompletion can't do as good job with them.
  • (AFAIU) They don't support environment variables
  • They can't be reodered, which is very handy for scripting, or when one wrote a long command invocation, and forgot only one argument somewhere.

The only time when positional arguments are OK is when the command really does have a one central argument that is very primary and mandatory. Like cat takes file paths. It would be somewhat annoying the have to do cat --path somefile --path someotherfile. But that's usually only a concern for commands really meant for short-form interactive use.

I'd like us to stop using positional arguments.

@elsirion
Copy link
Contributor

I'd say a second exception are subcommands. E.g. gateway-cli could live on as fedimint-cli gateway <args…>.

@dpc
Copy link
Contributor Author

dpc commented Jan 31, 2023

I'd say a second exception are subcommands. E.g. gateway-cli could live on as fedimint-cli gateway <args…>.

Not sure if I understand you, but I don't think I've ever seen subcommands being non-positional. Is it even doable? But agreed - subcommands are highly positional.

@elsirion
Copy link
Contributor

I have seen software where subcommands were implicitly accomplished using mutually exclusive flags, which I find rather annoying. So yeah, please let subcommands be positional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli good first issue Good for newcomers
Projects
None yet
3 participants