Class: PhilColumns::Cli::Generate

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



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

def self.banner( 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.message}", ''
  $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

Instance Method Details

#seed(name) ⇒ Object



16
17
18
# File 'lib/phil_columns/cli/generate.rb', line 16

def seed( name )
  PhilColumns::Command::Generate::Seed.new( options.merge( seed_name: name )).execute
end