Class: PhilColumns::Cli::List
- Inherits:
-
Thor
- Object
- Thor
- PhilColumns::Cli::List
- Defined in:
- lib/phil_columns/cli/list.rb
Class Method Summary collapse
- .banner(command, namespace = nil, subcommand = false) ⇒ Object
- .env_option ⇒ Object
- .handle_argument_error(command, error, _, __) ⇒ Object
- .handle_argument_error_default(command, error) ⇒ Object
- .handle_no_command_error(name) ⇒ Object
- .operation_option ⇒ Object
Instance Method Summary collapse
Class Method Details
.banner(command, namespace = nil, subcommand = false) ⇒ Object
7 8 9 10 |
# File 'lib/phil_columns/cli/list.rb', line 7 def self.( command, namespace=nil, subcommand=false ) return "#{basename} list help [SUBCOMMAND]" if command.name == 'help' "#{basename} #{command.usage}" end |
.env_option ⇒ Object
12 13 14 |
# File 'lib/phil_columns/cli/list.rb', line 12 def self.env_option option :env, type: :string, aliases: '-e', desc: "The environment to execute in", default: 'development' end |
.handle_argument_error(command, error, _, __) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/phil_columns/cli/list.rb', line 45 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
55 56 57 58 59 60 |
# File 'lib/phil_columns/cli/list.rb', line 55 def self.handle_argument_error_default( command, error ) $stdout.puts "Incorrect usage of list subcommand: #{command.name}" $stdout.puts " #{error.}", '' $stdout.puts "For correct usage:" $stdout.puts " phil_columns list help #{command.name}" end |
.handle_no_command_error(name) ⇒ Object
62 63 64 |
# File 'lib/phil_columns/cli/list.rb', line 62 def self.handle_no_command_error( name ) $stdout.puts "Unrecognized command: #{name}" end |
.operation_option ⇒ Object
16 17 18 |
# File 'lib/phil_columns/cli/list.rb', line 16 def self.operation_option option :operation, type: :string, aliases: '-o', desc: "The operation: all or any", default: 'any' end |
Instance Method Details
#tagged_with(*tags) ⇒ Object
30 31 32 |
# File 'lib/phil_columns/cli/list.rb', line 30 def tagged_with( * ) PhilColumns::Command::List::TaggedWith.new( .merge( tags: )).execute end |