-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Option to disable replacement of "_" with "-" in named cli arguments #220
Comments
Hi @pppmlt, thank you for your interest in Argh! I'm afraid underscores are not supported in long option names at the moment. While it's of course possible to implement, I'm not sure if it should be done. The GNU Program Argument Syntax Conventions explicitly recommends the
The purpose of Argh is to map function signatures to CLI patterns. This means translation between two different worlds and conventions that exist there. That's why we introduce the leading hyphens where you don't have them in Python function arguments, for example. So I think it's reasonable to stick to the GNU convention for argument syntax. I would close the issue but please feel free to reopen it if you have a valid use case. |
Thank you for explaining the reasoning behind this. The use-case I had in mind is related to Azure ML and their CLI syntax. Having to write argparse code for these files is painful and verbose. This is why argh would be useful here. However, if one has to use different names "inside" and "outside" of python seems like its bound to cause mistakes. I do understand that this might be to much of a niche use-case to be implemented here. |
@pppmlt thank you for explanation and example! That's indeed a valid use case, even if a niche one. I'll take another look at it and see how to make it configurable. It should be probably on app level, not per command, because inconsistency is worse as a source of errors than the need to convert between dashes and underscores. (Can't promise a quick fix.) |
When dispatching a function like the following
def example(*args, this_is_a_long_name): [..]
the cli argument will have the "_" replaced with "-".
I would like to have the CLI arguments names (
--this_is_a_long_name
) to be identical to my function argument names (this_is_a_long_name
). Is there any way to achieve this?The text was updated successfully, but these errors were encountered: