To define a command, define a class and inherit Cli::Command.
Cli::Command
class Smile < Cli::Command end
To run a command, define a #run method in your command class and call the .run method.
#run
.run
class Smile < Cli::Command def run puts ":)" end end Smile.run
This prints:
:)
To pass arguments to a command, call .run with arguments.
class Smile < Cli::Command def run puts "#{args[0]} :)" end end Smile.run %w(hello)
hello :)
There was an error while loading. Please reload this page.