You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to generate the following type of usage template:
Usage: my_program <host><port>
So far, I've realized I can't use ARG_POSITIONAL_SINGLE twice in a row as it throws an error.
And using the following template:
# ARG_POSITIONAL_MULTI([host][port],[Your host][Your port],2,[hosts][port])
# ARG_HELP([short program description (optional)], [long program description (optional)])
# ARGBASH_GO()
generates the help message:
short program description (optional)
Usage: script [-h|--help] <hostport-1> [<hostport-2>]
<hostport>: Your hostYour port (defaults for <hostport-2>: 'hostsport')
-h,--help: Prints help
long program description (optional)
Although they are technically repeated arguments with a max number of 2 repeats, I would like to know if it's possible to customize the template so that it generates my desired output.
Would really appreciate any guidance here. Thanks!
The text was updated successfully, but these errors were encountered:
Hello, the correct way to go would be to have two instances of ARG_POSITIONAL_SINGLE.
Argbash should not complain about this, unless both of those arguments have defaults. Why? The short version of explanation would be that if both arguments have defaults, then it is unclear what was specified, was it the port, or the host?
If you want defaults for both, then the cleanest solution for the time being would be to have one positional argument with default for host and one optional argument with default for the port number.
For the sake of completness: The output of ARG_POSITIONAL_MULTI from your example is OK (i.e. it is not a bug). Specifying [host][port] is the same as [hostport].
I'm trying to generate the following type of usage template:
So far, I've realized I can't use
ARG_POSITIONAL_SINGLE
twice in a row as it throws an error.And using the following template:
generates the help message:
Although they are technically repeated arguments with a max number of 2 repeats, I would like to know if it's possible to customize the template so that it generates my desired output.
Would really appreciate any guidance here. Thanks!
The text was updated successfully, but these errors were encountered: