Class: Arison::CLI
- Inherits:
-
Thor
- Object
- Thor
- Arison::CLI
- Defined in:
- lib/arison/cli.rb
Instance Method Summary collapse
- #columns(table_name) ⇒ Object
- #import(table) ⇒ Object
- #info ⇒ Object
-
#initialize(args = [], options = {}, config = {}) ⇒ CLI
constructor
A new instance of CLI.
- #query_file(file) ⇒ Object
- #query_inline ⇒ Object
- #tables ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ CLI
Returns a new instance of CLI.
18 19 20 21 22 23 24 |
# File 'lib/arison/cli.rb', line 18 def initialize(args = [], = {}, config = {}) super(args, , config) @global_options = config[:shell].base. @config = YAML.load_file(@global_options['config']) profile = @config[@global_options['profile']] @core = Core.new(profile) end |
Instance Method Details
#columns(table_name) ⇒ Object
43 44 45 |
# File 'lib/arison/cli.rb', line 43 def columns(table_name) puts_json @core.columns_with_table_name(table_name) end |
#import(table) ⇒ Object
48 49 50 51 52 |
# File 'lib/arison/cli.rb', line 48 def import(table) data = @core.parse_json(STDIN.read) @core.create_table(table, data) @core.import(table, data) end |
#info ⇒ Object
55 56 57 |
# File 'lib/arison/cli.rb', line 55 def info puts_json @config end |
#query_file(file) ⇒ Object
33 34 35 |
# File 'lib/arison/cli.rb', line 33 def query_file(file) puts_json @core.query(File.read(file)) end |
#query_inline ⇒ Object
28 29 30 |
# File 'lib/arison/cli.rb', line 28 def query_inline puts_json @core.query(['query']) end |
#tables ⇒ Object
38 39 40 |
# File 'lib/arison/cli.rb', line 38 def tables puts_json @core.tables end |
#version ⇒ Object
60 61 62 |
# File 'lib/arison/cli.rb', line 60 def version puts VERSION end |