lib/sportdb/cli/main.rb in sportdb-1.9.16 vs lib/sportdb/cli/main.rb in sportdb-1.10.0
- old
+ new
@@ -6,26 +6,17 @@
# ruby -I ../../github/sport.db.ruby/lib
# ../../github/sport.db.ruby/lib/sportdb.rb
# setup --delete --sport
# --include ../../github/football.db
-
-require 'gli'
include GLI::App
-# our own code / additional for cli only
-require 'logutils/db'
-require 'sportdb/cli/opts'
-
-require 'datafile' ## lets us use Datafile::Builder,Datafile etc.
-
-
program_desc 'sport.db command line tool'
-version SportDb::VERSION
+version SportDbCli::VERSION
LogUtils::Logger.root.level = :info # set logging level to info
logger = LogUtils::Logger.root
@@ -70,11 +61,11 @@
switch [:q, :quiet], negatable: false
def connect_to_db( options )
- puts SportDb.banner
+ puts SportDbCli.banner
puts "working directory: #{Dir.pwd}"
SportDb.connect( adapter: 'sqlite3',
database: "#{options.db_path}/#{options.db_name}" )
@@ -328,11 +319,11 @@
command :logs do |c|
c.action do |g,o,args|
connect_to_db( opts )
- LogDb::Models::Log.all.each do |log|
+ LogDb::Model::Log.all.each do |log|
puts "[#{log.level}] -- #{log.msg}"
end
puts 'Done.'
end
@@ -392,11 +383,11 @@
pre do |g,c,o,args|
opts.merge_gli_options!( g )
opts.merge_gli_options!( o )
- puts SportDb.banner
+ puts SportDbCli.banner
if opts.verbose?
LogUtils::Logger.root.level = :debug
end
@@ -420,6 +411,6 @@
false # skip default error handling
end
-exit run(ARGV)
\ No newline at end of file
+exit run(ARGV)