Class: Mode::CLI::Base
- Inherits:
-
Thor
- Object
- Thor
- Mode::CLI::Base
show all
- Includes:
- Helpers
- Defined in:
- lib/mode/cli/base.rb,
lib/mode/cli/login.rb,
lib/mode/cli/import.rb,
lib/mode/cli/analyze.rb,
lib/mode/cli/connect.rb,
lib/mode/cli/package.rb
Instance Method Summary
collapse
Methods included from Helpers
#valid_file?, #valid_table?
Instance Method Details
#analyze(path = nil) ⇒ Object
option :keys, :banner => ‘POSITIONS (ex: 0,2)’, :default => String.new
#connect(command) ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/mode/cli/connect.rb', line 7
def connect(command)
if ['start', 'stop', 'restart'].include?(command)
Mode::Commands::Connect.new(command, options).execute
else
say "Error: valid commands for connect are start, stop and restart"
end
rescue => err
say "Error: #{err.message}"
end
|
#import(source, table) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/mode/cli/import.rb', line 22
def import(source, table)
unless valid_table?(table)
error "Error: Invalid account or table name given"
return
end
account, table_name = *table.split('/')
Mode::Commands::Import.new(source, account, table_name).execute
end
|
#login ⇒ Object
8
9
10
|
# File 'lib/mode/cli/login.rb', line 8
def login
Mode::Commands::Login.new(options).execute
end
|
#package(source, package_path) ⇒ Object
7
8
9
10
|
# File 'lib/mode/cli/package.rb', line 7
def package(source, package_path)
name = options[:name] || package_path.split(File::Separator).last
Mode::Commands::Package.new(source, package_path, name, options[:resource_name]).execute
end
|
#version ⇒ Object
11
12
13
|
# File 'lib/mode/cli/base.rb', line 11
def version
say "Mode CLI Version #{Mode::VERSION}"
end
|