module BranchIOCLI::Format::ShellFormat
Public Instance Methods
all_commands()
click to toggle source
# File lib/branch_io_cli/format/shell_format.rb, line 22 def all_commands Dir[File.expand_path(File.join("..", "..", "command", "**_command.rb"), __FILE__)].map { |p| p.sub(%r{^.*/([a-z0-9_]+)_command.rb$}, '\1') } end
option(opt)
click to toggle source
# File lib/branch_io_cli/format/shell_format.rb, line 6 def option(opt) o = @configuration.available_options.find { |o1| o1.name == opt.to_sym } cli_opt = opt.to_s.gsub(/_/, '-') all_opts = o.aliases || [] if o.nil? || o.default_value.nil? || o.default_value != true all_opts << "--#{cli_opt}" else all_opts << "--no-#{cli_opt}" end all_opts.join(" ") end
options_for_command(command)
click to toggle source
# File lib/branch_io_cli/format/shell_format.rb, line 26 def options_for_command(command) @configuration = BranchIOCLI::Configuration.const_get("#{command.capitalize}Configuration") @configuration.available_options.map { |o| option(o.name) }.join(" ") end