argbash
argbash copied to clipboard
feature request: ARG_USE_ENV required field
It would be nice to specify if an ARG_USE_ENV var is required to be set. If it's not set, when the user calls the generated shell script, then an error should be output
ARG_USE_ENV([KEYNAME], , [openstack security keypair name to add to your server], [True]) where the last arg ([True]) means it's a required evironment variable. Yes, I can set the default, but the default value might be bogus.... Think password env var, it makes no sense to have a default for that, but it makes sense that it needs to be set.
The help output should note that it's a required field.
I will give this a thought. I am little bit reluctant to implement it in Argbash, as I believe that
- required input should be supplied via positional arguments, and
- missing value of an env variable is super easy to handle in the script's body.
-
true, but you typically don't want a password on the command line as that can be seen elsewhere, especially if the script is long running . ./my_script -u myuser -p mypassword
-
Also true, but I would assume that argbash is for parsing and handling arguments and although it can be handled manually in the script body, it would be nice if the argparser generated would handle all required arguments.
Argbash could also generate references to the environment variables in the help function.
Argbash could also generate references to the environment variables in the help function.
What do you mean? If you declare an env variable input, the help function gets expanded appropriately.
Oh that's great! I didn't notice it, my bad.