Class: Lolcode::CLI
- Inherits:
-
Object
- Object
- Lolcode::CLI
- Defined in:
- lib/lolcode/cli.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize ⇒ CLI
8 9 10 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 |
# File 'lib/lolcode/cli.rb', line 8 def initialize self. = {} OptionParser.new do |opts| opts. = "Welcome to Lolcode.\nWhen file is given it is a script excutor, otherwise it's a interpretor.\nUsage: lolcode [options] [file]\n" opts.on("-v", "Run verbosely") do |v| self.[:verbose] = v end opts.on_tail("-h", "--help", "Show this message") do puts opts exit 1 end self.files = opts.permute(ARGV) # rest args in ARGV end.parse! if self.files.empty? interpretor else excutor end end |
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files.
6 7 8 |
# File 'lib/lolcode/cli.rb', line 6 def files @files end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/lolcode/cli.rb', line 6 def end |