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
Right now, '--help' outputs a rather generic 'usage' line:
usage: foo.rb [...--param=val...]
The only thing that changes is the script file name.
I'm writing a script that accepts one of several commands ('list', 'run', 'help') before handing things over to configliere for parsing.
Unfortunately, I can't seem to cleanly override the usage output such that:
$ foo.rb
usage: foo.rb [command]
Commands:
run - run some stuff
list - list stuff to run
help - get some help
$ foo.rb run --help
usage: foo.rb run [...--param=val...]
Params:
bla bla bla
$ foo.rb list --help
usage: foo.rb list [...--param=val...]
Params:
bla bla bla
It's trivial to parse the 'command' from ARGV (just an ARGV.shift) and then directing things to the appropriate instance of Configliere::Param.
Looking at Configliere::Commandline, it appears that there might have been some intent to support overriding the parsers 'usage', as there is an an 'attr_writer :usage'.
The only way I've managed to override the usage was by doing something like:
params = Configliere::Param.new
params.use(:commandline)
my_usage_mod = Module.new do
def usage
"usage: #{raw_script_name} run [...-param=val...]"
end
end
params.extend my_usage_mod
I've no problem tweaking things and sending a pull request. I just wanted to make sure I wasn't missing something, first.
The text was updated successfully, but these errors were encountered:
Right now, '--help' outputs a rather generic 'usage' line:
The only thing that changes is the script file name.
I'm writing a script that accepts one of several commands ('list', 'run', 'help') before handing things over to configliere for parsing.
Unfortunately, I can't seem to cleanly override the usage output such that:
It's trivial to parse the 'command' from ARGV (just an ARGV.shift) and then directing things to the appropriate instance of Configliere::Param.
Looking at Configliere::Commandline, it appears that there might have been some intent to support overriding the parsers 'usage', as there is an an 'attr_writer :usage'.
The only way I've managed to override the usage was by doing something like:
I've no problem tweaking things and sending a pull request. I just wanted to make sure I wasn't missing something, first.
The text was updated successfully, but these errors were encountered: