Class: Arison::CLI
- Inherits:
- 
      Thor
      
        - Object
- Thor
- Arison::CLI
 
- Defined in:
- lib/arison/cli.rb
Instance Method Summary collapse
- #columns ⇒ Object
- #import ⇒ 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.
| 17 18 19 20 21 22 23 24 25 | # File 'lib/arison/cli.rb', line 17 def initialize(args = [], = {}, config = {}) super(args, , config) @global_options = config[:shell].base. if @global_options[:config] && File.exist?(@global_options[:config]) profile = Util.get_profile(@global_options[:config], @global_options[:profile]) @core = Core.new(profile) end end | 
Instance Method Details
#columns ⇒ Object
| 45 46 47 | # File 'lib/arison/cli.rb', line 45 def columns puts_json @core.columns_with_table_name([:table]) end | 
#import ⇒ Object
| 52 53 54 55 56 | # File 'lib/arison/cli.rb', line 52 def import data = ([:data] ? [:data] : nil) || Util.parse_json(STDIN.read) data = [data] if data.class == Hash @core.import([:table], data) end | 
#info ⇒ Object
| 59 60 61 | # File 'lib/arison/cli.rb', line 59 def info puts_json @config end | 
#query_file(file) ⇒ Object
| 34 35 36 | # File 'lib/arison/cli.rb', line 34 def query_file(file) puts_json @core.query(File.read(file)) end | 
#query_inline ⇒ Object
| 29 30 31 | # File 'lib/arison/cli.rb', line 29 def query_inline puts_json @core.query([:query]) end | 
#tables ⇒ Object
| 39 40 41 | # File 'lib/arison/cli.rb', line 39 def tables puts_json @core.tables end | 
#version ⇒ Object
| 64 65 66 | # File 'lib/arison/cli.rb', line 64 def version puts VERSION end |