module Climatic::ConfigLayers::CommandLineManagerBinder
Constants
- SUB_COMMANDS_HELP_HEADER
Attributes
command_line_manager[RW]
Public Instance Methods
cmd_line_args()
click to toggle source
# File lib/climatic/config_layers/command_line_manager_binder.rb, line 16 def cmd_line_args command_line_manager.cmd_line_args end
cmd_line_args=(args)
click to toggle source
# File lib/climatic/config_layers/command_line_manager_binder.rb, line 20 def cmd_line_args=(args) command_line_manager.cmd_line_args = args reload end
extra_parameters()
click to toggle source
# File lib/climatic/config_layers/command_line_manager_binder.rb, line 25 def extra_parameters with_selected_command {|c| c.extra_arguments } end
help()
click to toggle source
# File lib/climatic/config_layers/command_line_manager_binder.rb, line 38 def help with_selected_command do |c| if c.root_command? res = c.help sub_commands = command_line_manager.commands.select {|command| not command.root_command?} unless sub_commands.empty? res.concat SUB_COMMANDS_HELP_HEADER sub_commands.sort{|a,b| a.name <=> b.name }.each do |command| # command_summary = "#{command.help[0][0,60].tr("\n", ' ')}..." res << " * #{command.name}: #{command_summary command}" end end res else c.help end end end
load()
click to toggle source
# File lib/climatic/config_layers/command_line_manager_binder.rb, line 29 def load with_selected_command do |c| replace c.params_hash @file_name = :none end self end
Also aliased as: reload
Private Instance Methods
command_summary(command)
click to toggle source
# File lib/climatic/config_layers/command_line_manager_binder.rb, line 60 def command_summary(command) text = command.help[0][0,60].tr("\n", ' ') text.match(/^\s*(?<sentence>[^\s][^\.]+)\./) do |md| return "#{md['sentence']} ..." end text end
with_selected_command(&block)
click to toggle source
# File lib/climatic/config_layers/command_line_manager_binder.rb, line 68 def with_selected_command(&block) selected_command = nil begin selected_command = command_line_manager.command rescue UltraCommandLine::Error => e UltraCommandLine.logger.debug 'No valid command found !' end unless selected_command.nil? block.call selected_command end end