module Bosh::Cli::CommandDiscovery
Public Instance Methods
desc(string)
click to toggle source
# File lib/cli/command_discovery.rb, line 10 def desc(string) @desc = string end
method_added(method_name)
click to toggle source
@param [Symbol] method_name Method name
# File lib/cli/command_discovery.rb, line 19 def method_added(method_name) if @usage && @desc @options ||= [] method = instance_method(method_name) register_command(method, @usage, @desc, @options) end @usage = nil @desc = nil @options = [] end
option(name, *args)
click to toggle source
# File lib/cli/command_discovery.rb, line 14 def option(name, *args) (@options ||= []) << [name, args] end
register_command(method, usage, desc, options = [])
click to toggle source
@param [UnboundMethod] method Method implementing the command @param [String] usage Command
usage (used to parse command) @param [String] desc Command
description @param [Array] options Command
options
# File lib/cli/command_discovery.rb, line 34 def register_command(method, usage, desc, options = []) command = CommandHandler.new(self, method, usage, desc, options) Bosh::Cli::Config.register_command(command) end
usage(string = nil)
click to toggle source
# File lib/cli/command_discovery.rb, line 6 def usage(string = nil) @usage = string end