ruby - Thor Executable - Ignore Task Name -


Thor wiki page shows you how to create a thor powered CLI command, which looks like this:

bash. / Mythorcommand foo

For this, you first need to pass the great task foo in the argument

I used to call Default_method can run a great executable without any arguments:

bash ./mythorcommand

However, I I want to give the first argument as a variable string:

bash. / Mythorcommand "somevalue"

This does not work because the logic of the Great Command is the first argument to be argued. Is there any way to ignore the work name and send the first argument to the default argument?

If this functionality does not exist, then I think it would be very useful to add a method that will pass all command line arguments in one function / method:

 < Code> class MyThorCommand & LT; Thor only_method: Default defines default (* args) args.inpsect end end MyThorCommand.start    

You should expand from Thor :: Group and call that method to start

  class test & lt; Thor :: Group Dis "Act Statement" DEFT Act "WWW" & End Start     

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -