lib/arql/cli.rb in arql-0.1.15 vs lib/arql/cli.rb in arql-0.1.16
- old
+ new
@@ -20,12 +20,12 @@
OptionParser.new do |opts|
opts.banner = <<~EOF
Usage: arql [options] [ruby file]
- If neither [ruby file] nor -e option specified, a Pry REPL will be launched,
- otherwise the specified ruby file or -e option value will be run, and no REPL launched
+ If neither [ruby file] nor -e option specified, and STDIN is not a tty, a Pry REPL will be launched,
+ otherwise the specified ruby file or -e option value or ruby code read from STDIN will be run, and no REPL launched
EOF
opts.on('-cCONFIG_FILE', '--conf=CONFIG_FILE', 'Specify config file, default is $HOME/.arql.yml, or $HOME/.arql.d/init.yml.') do |config_file|
@options.config_file = config_file
@@ -105,10 +105,15 @@
opts.on('-AOUTPUT', '--append-sql=OUTPUT', 'Append SQL to OUTPUT file') do |file|
@options.append_sql = file
end
+ opts.on('-V', '--version', 'Prints version') do
+ puts "ARQL #{Arql::VERSION}"
+ exit
+ end
+
opts.on('', '--help', 'Prints this help') do
puts opts
exit
end
@@ -127,16 +132,12 @@
conf = File.expand_path('~/.arql.d/init.yaml')
return conf if File.file?(conf)
end
def default_initializer
- conf = File.expand_path('~/.arql.yml')
+ conf = File.expand_path('~/.arql.rb')
return conf if File.file?(conf)
- conf = File.expand_path('~/.arql.yaml')
- return conf if File.file?(conf)
- conf = File.expand_path('~/.arql.d/init.yml')
- return conf if File.file?(conf)
- conf = File.expand_path('~/.arql.d/init.yaml')
+ conf = File.expand_path('~/.arql.d/init.rb')
return conf if File.file?(conf)
end
end
end
end