class Fission::Command
def self.help
Fission::Command::Suspend.help
Examples
any class which inherits from this class.
This method will call the 'option_parser' method which must be defined in
intended to be used by a command class which inherits from this class.
Internal: Helper method to return the help text of a command. This is
def self.help self.new.option_parser.to_s end
def command_name(klass=self)
# => 'snapshot list'
Fission::Command::SnapshotList.new.command_name
#xamples:
This should only be called against descendants of this class.
Internal: Helper method to determine the command name of command class.
def command_name(klass=self) klass.class.name.split('::')[2]. gsub(/([a-z\d])([A-Z])/,'\1_\2'). gsub('_', ' ').downcase end
def execute
command.execute
Examples
Internal: Primary method for performing an action within a command.
def execute parse_arguments end
def initialize(args=[])
Examples
variable.
args - Array of arguments which will be assigned to the args instance
from.
intended to be used as a base class for other command classes to inherit
Internal: Initializes a new Command with some basic setup. This is
def initialize(args=[]) ui @options = OpenStruct.new @args = args end
def summary
# => 'This command does x and y'
command.summary
Examples
class which inherits from this class.
Internal: Summmary of the command. This is to be implemented by any
def summary raise NotImplementedError end
def ui
command.ui.output 'foo'
Examples
Internal: Helper method used to delegate UI related methods through.
def ui @ui ||= UI.new end