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

Search up subcommand tree for unrecognized flags? #22

Open
cgay opened this issue Jul 14, 2021 · 0 comments
Open

Search up subcommand tree for unrecognized flags? #22

cgay opened this issue Jul 14, 2021 · 0 comments

Comments

@cgay
Copy link
Member

cgay commented Jul 14, 2021

This is a potential feature but probably warrants a little research before implementing it. I'm thinking it could be more intuitive to search up the subcommand tree (I'm currently adding support for multi-level subcommands) for options that aren't matched by the current subcommand. For example, if we have these commands:

dylan [--verbose --debug] new workspace [other options]
dylan [--verbose --debug] new library [other options]

then currently one has to invoke like this: dylan --verbose new workspace --blah my-project

The idea is to allow this as well: dylan new workspace --verbose --blah my-project

My thinking is that this puts less burden on the end-user to remember which part of the command defines the --verbose flag. I should note that this idea originally came from the "fallthrough" option here, where they went literally insane with options.

If there were any conflict (e.g., the new or the workspace subcommand accepted its own --verbose flag) then obviously the nearer one would take precedence, but (a) that should be very rare and (b) don't design your command line that way.

I did check Python argparse and they do not appear to support this feature. They parse the way we currently do.

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

No branches or pull requests

1 participant