Closed camertron closed 3 years ago
Weird. This works for me. Can you post a fuller example that I can try locally to debug?
OK, figured it out. You have arguments :strict
(which I think the generator uses by default), which means that if you don't specify an arg for a command, it will error out.
diff --git a/bin/executable b/bin/executable
index d9bb7c3..e7b3798 100755
--- a/bin/executable
+++ b/bin/executable
@@ -19,6 +19,7 @@ end
desc 'Testing testing foo bar'
command :deploy do |d|
+ d.arg "blah", :optional
d.command :exec do |subcmd|
subcmd.desc '0-based instance index'
subcmd.default_value 0
@@ -29,6 +30,7 @@ command :deploy do |d|
subcmd.arg_name 'TARGET'
subcmd.flag [:t, :target], type: Symbol
subcmd.action do |global_options, options, args|
puts 'fooooo'
end
It's weird, but to set the arg for subcmd
, you set it on d
, but if you do this, it does work.
Huh ok thanks! Might be worth a mention in the README :)
I'm trying to write a subcommand with a stop switch (i.e.
--
) but GLI always spits out an error saying I've provided too many arguments:What am I doing wrong?