Class: PhilColumns::Cli::Generate
- Inherits:
-
Thor
- Object
- Thor
- PhilColumns::Cli::Generate
- Defined in:
- lib/phil_columns/cli/generate.rb
Class Method Summary collapse
- .banner(command, namespace = nil, subcommand = false) ⇒ Object
- .handle_argument_error(command, error, _, __) ⇒ Object
- .handle_argument_error_default(command, error) ⇒ Object
- .handle_no_command_error(name) ⇒ Object
Instance Method Summary collapse
Class Method Details
.banner(command, namespace = nil, subcommand = false) ⇒ Object
7 8 9 10 |
# File 'lib/phil_columns/cli/generate.rb', line 7 def self.( command, namespace=nil, subcommand=false ) return "#{basename} generate help [SUBCOMMAND]" if command.name == 'help' "#{basename} #{command.usage}" end |
.handle_argument_error(command, error, _, __) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/phil_columns/cli/generate.rb', line 20 def self.handle_argument_error( command, error, _, __ ) method = "handle_argument_error_for_#{command.name}" if respond_to?( method ) send( method, command, error ) else handle_argument_error_default( command, error ) end end |
.handle_argument_error_default(command, error) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/phil_columns/cli/generate.rb', line 30 def self.handle_argument_error_default( command, error ) $stdout.puts "Incorrect usage of generate subcommand: #{command.name}" $stdout.puts " #{error.}", '' $stdout.puts "For correct usage:" $stdout.puts " phil_columns generate help #{command.name}" end |
.handle_no_command_error(name) ⇒ Object
37 38 39 |
# File 'lib/phil_columns/cli/generate.rb', line 37 def self.handle_no_command_error( name ) $stdout.puts "Unrecognized command: #{name}" end |