argbash
argbash copied to clipboard
Issue to retrieve values when defining camelCase arguments
Hello,
I'm using argBash to wrap my CLI and it's working quite well except when you set arguments as camelCase. I couldn't find the information that explicitly tells not to use camelCase so I was expecting it to work without any issue. Question is: Will you be in position to support camelCase arguments? Otherwise, could you please update argbash documentation to highlight this limitation.
Examples of camel case arguments: ARG_OPTIONAL_SINGLE([myVar], [v], [My Variable], [default value])
When trying to get value using : ${_arg_myVar}, ${_arg_my_var} or ${_arg_my_Var}, nothing happens.
Kindly regards,
Can you please share both the example argbash template code you're using and the resulting output.
Hi, here is the argBash template for this script:
#
# This is a rather minimal example Argbash potential
# Example taken from http://argbash.readthedocs.io/en/stable/example.html
#
# ARG_OPTIONAL_SINGLE([myVar], [v], [My Variable], [default value])
# ARG_HELP([The general script's help msg])
# ARGBASH_GO
# [ <-- needed because of Argbash
echo "Value of --option: ${_arg_myVar}"
# ] <-- needed because of Argbash
Can please edit your comment to be properly formatted as code, https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#fenced-code-blocks
Oh, I'm really sorry @gdevenyi, I didn't checked code format and trusted the single backtick... My previous comment has just been updated to parse code the proper way.
The answer is very simple, the variable is named _arg_myvar
, as you can read from the generated code. IOW, the name is converted to lowercase, while the rest s.a. help messages is preserved.
See also: https://argbash.readthedocs.io/en/latest/guide.html#using-parsing-results