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

Running sdw-admin --appl (typo) still provisions #1071

Open
1 task done
legoktm opened this issue Jun 6, 2024 · 2 comments
Open
1 task done

Running sdw-admin --appl (typo) still provisions #1071

legoktm opened this issue Jun 6, 2024 · 2 comments

Comments

@legoktm
Copy link
Member

legoktm commented Jun 6, 2024

  • I have searched for duplicates or related issues

Description

A typo in sdw-admin flags wasn't caught

Steps to Reproduce

  1. Run sdw-admin --appl, note that I missed the y.

Expected Behavior

An error that --appl isn't a valid option

Actual Behavior

Provisioning begins...

Comments

I'm not immediately sure why this is happening, I assume there's some logic bug in our argparse handling.

@legoktm
Copy link
Member Author

legoktm commented Jun 6, 2024

This seems to be some argparse feature? It automatically created short versions for all the flags, as long as it's a substring, --a -> apply, --u -> uninstall, etc.

@legoktm
Copy link
Member Author

legoktm commented Jun 6, 2024

https://docs.python.org/3/library/argparse.html#argument-abbreviations-prefix-matching

The parse_args() method by default allows long options to be abbreviated to a prefix, if the abbreviation is unambiguous (the prefix matches a unique option):

I'm a bit dubious of this and not requiring people to be strict/explicit, but also if it's the default and I haven't run into it until now, maybe it's OK?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant