mirror of https://github.com/Calamitous/iris.git
Add some CLI options
This commit is contained in:
parent
9e51c00dfb
commit
898fa4e5ef
40
iris.rb
40
iris.rb
|
@ -476,7 +476,7 @@ class Interface
|
||||||
|
|
||||||
def help
|
def help
|
||||||
puts
|
puts
|
||||||
puts "Iris v#{Config::VERSION}"
|
puts "Iris v#{Config::VERSION} readline interface"
|
||||||
puts
|
puts
|
||||||
puts 'Commands'
|
puts 'Commands'
|
||||||
puts '========'
|
puts '========'
|
||||||
|
@ -515,7 +515,45 @@ class Interface
|
||||||
end
|
end
|
||||||
|
|
||||||
class CLI
|
class CLI
|
||||||
|
def self.puts_help
|
||||||
|
puts
|
||||||
|
puts "Iris v#{Config::VERSION} command-line"
|
||||||
|
puts
|
||||||
|
puts 'Usage'
|
||||||
|
puts '========'
|
||||||
|
puts "#{__FILE__} [options]"
|
||||||
|
puts
|
||||||
|
puts 'Options'
|
||||||
|
puts '========'
|
||||||
|
puts '--help, -h - Display this text.'
|
||||||
|
puts '--version, -v - Display the current version of Iris.'
|
||||||
|
puts '--stats, -s - Display data about the system.'
|
||||||
|
puts '--interactive, -i - Enter interactive mode (default)'
|
||||||
|
puts
|
||||||
|
puts 'If no options are provided, Iris will enter interactive mode.'
|
||||||
|
end
|
||||||
|
|
||||||
def self.start(args)
|
def self.start(args)
|
||||||
|
if (args & %w{-v --version}).any?
|
||||||
|
puts "Iris #{Config::VERSION}"
|
||||||
|
exit(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (args & %w{-h --help}).any?
|
||||||
|
puts_help
|
||||||
|
exit(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (args & %w{-s --stats}).any?
|
||||||
|
Corpus.load
|
||||||
|
puts "Iris #{Config::VERSION}"
|
||||||
|
puts "#{Corpus.topics.size} topics."
|
||||||
|
puts "#{Corpus.all.size} messages total."
|
||||||
|
puts "#{Corpus.all.map(&:author).uniq.size} authors."
|
||||||
|
exit(0)
|
||||||
|
end
|
||||||
|
puts "Unrecognized option(s) #{args.join(', ')}"
|
||||||
|
puts "Try -h for help"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue