Class: Agen::CLI
- Inherits:
-
Object
- Object
- Agen::CLI
- Defined in:
- lib/agen/cli.rb
Instance Method Summary collapse
-
#initialize(args = []) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(args = []) ⇒ CLI
Returns a new instance of CLI.
7 8 9 |
# File 'lib/agen/cli.rb', line 7 def initialize(args = []) @args = args end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/agen/cli.rb', line 11 def run = {} OptionParser.new do |opts| opts. = "Usage: agen [options]" opts.on("-v", "--version", String, "Version") do |v| puts Agen::VERSION return false end opts.on("-nNUMBER", "--number=NUMBER", Integer, "Number of aliases to generate") do |n| [:number] = n end opts.on("-a", "--auto", "Aliases will be generated and applied automatically") do |a| [:auto] = a end opts.on("-rRCFILE", "--rcfile=RCFILE", String, "Path to shell rc file") do |r| [:rcfile] = r end opts.on("-sHISTFILE", "--shell-history=HISTFILE", String, "Path to shell history file") do |s| [:histfile] = s end end.parse! = Shell.new(). return unless Runner.new(**).run end |