class Arison::CLI
Public Class Methods
new(args = [], options = {}, config = {})
click to toggle source
Calls superclass method
# File lib/arison/cli.rb, line 16 def initialize(args = [], options = {}, config = {}) super(args, options, config) @global_options = config[:shell].base.options 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
Public Instance Methods
columns()
click to toggle source
# File lib/arison/cli.rb, line 44 def columns puts_json @core.columns_with_table_name(options[:table]) end
import()
click to toggle source
# File lib/arison/cli.rb, line 51 def import data = (options[:data] ? options[:data] : nil) || Util.parse_json(STDIN.read) data = [data] if data.class == Hash @core.import(options[:table], data) end
info()
click to toggle source
# File lib/arison/cli.rb, line 58 def info puts_json @config end
query_file(file)
click to toggle source
# File lib/arison/cli.rb, line 33 def query_file(file) puts_json @core.query(File.read(file)) end
query_inline()
click to toggle source
# File lib/arison/cli.rb, line 28 def query_inline puts_json @core.query(options[:query]) end
tables()
click to toggle source
# File lib/arison/cli.rb, line 38 def tables puts_json @core.tables end
version()
click to toggle source
# File lib/arison/cli.rb, line 63 def version puts VERSION end
Private Instance Methods
puts_json(object)
click to toggle source
# File lib/arison/cli.rb, line 68 def puts_json(object) puts JSON.pretty_generate(object) end