Class: TTY::CLI

Inherits:
Thor
  • Object
show all
Extended by:
Licenses
Defined in:
lib/tty/cli.rb

Overview

Main CLI runner

Constant Summary collapse

Error =

Error raised by this runner

Class.new(StandardError)

Constants included from Licenses

Licenses::CUSTOM, Licenses::LICENSES

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Licenses

license_identifiers, licenses

Class Method Details

.helpObject



46
47
48
49
# File 'lib/tty/cli.rb', line 46

def self.help(*)
  puts top_banner
  super
end

Instance Method Details

#add(*names) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/tty/cli.rb', line 79

def add(*names)
  if options[:help]
    invoke :help, ['add']
  elsif names.size < 1
    fail Error, "'teletype add' was called with no arguments\n" \
                 "Usage: 'teletype add COMMAND_NAME'"
  else
    require_relative 'commands/add'
    TTY::Commands::Add.new(names, options).execute
  end
end

#new(app_name = nil) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/tty/cli.rb', line 120

def new(app_name = nil)
  if options[:help]
    invoke :help, ['new']
  elsif app_name.nil?
    fail Error, "'teletype new' was called with no arguments\n" \
                 "Usage: 'teletype new PROJECT_NAME'"
  else
    require_relative 'commands/new'
    TTY::Commands::New.new(app_name, options).execute
  end
end

#versionObject



133
134
135
136
# File 'lib/tty/cli.rb', line 133

def version
  require_relative 'version'
  puts "v#{TTY::VERSION}"
end