Class: PhilColumns::Cli::List

Inherits:
Thor
  • Object
show all
Defined in:
lib/phil_columns/cli/list.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



7
8
9
10
# File 'lib/phil_columns/cli/list.rb', line 7

def self.banner( command, namespace=nil, subcommand=false )
  return "#{basename} list help [SUBCOMMAND]" if command.name == 'help'
  "#{basename} #{command.usage}"
end

.env_optionObject



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.message}", ''
  $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_optionObject



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( *tags )
  PhilColumns::Command::List::TaggedWith.new( options.merge( tags: tags )).execute
end

#tagsObject



41
42
43
# File 'lib/phil_columns/cli/list.rb', line 41

def tags
  PhilColumns::Command::List::Tags.new( options ).execute
end