-
Notifications
You must be signed in to change notification settings - Fork 952
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
Add note to always use positional args first #15761
Add note to always use positional args first #15761
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱 😱
formatted_help += ("\nNOTE: Use always positional parameters first\n" | ||
" conan <command> <positional args> [optional args]\n") | ||
return formatted_help |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatted_help += ("\nNOTE: Use always positional parameters first\n" | |
" conan <command> <positional args> [optional args]\n") | |
return formatted_help | |
lines = formatted_help.splitlines() | |
note = ("\nNOTE: Use always positional parameters first\n" | |
" conan <command> <positional args> [optional args]\n") | |
lines.insert(lines.index(""), note) | |
return "\n".join(lines) |
I tried it, but I was not convinced, as it shows at the very end, not very visible when there are arguments.
Then I tried this, it seems it would be a bit better IMHO.
Still, it is also missing in the short usage error when some arg is missing or incorrect. This can be solved by adding the format_usage()
method too.
All in all, seems a bit too dirty/too much for a known Python bug: python/cpython#53584
Not sure what would be the best approach to be honest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just make sure we mention it somewhere in the docs then!
This adds a note to let the user know they should set positional args first in commands