Class: StackLoop::OptParse
- Inherits:
-
OptionParser
- Object
- OptionParser
- StackLoop::OptParse
- Defined in:
- lib/stack_loop/optparse.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ OptParse
constructor
A new instance of OptParse.
Constructor Details
#initialize(app) ⇒ OptParse
Returns a new instance of OptParse.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/stack_loop/optparse.rb', line 5 def initialize(app) @app = app super do |opti| opti. = "Usage: #$0 [options]" opti.on("-c", "--command COMMAND", "The command string prefix to run") do |command| app.command = command end opti.on("-s", "--stack-file FILE", "The file to read for argument sets") do |stack| app.stack_file = stack end opti.on("-p", "--push-file FILE", "A path to read for new argument sets") do |file| #ok app.collect_file = file end opti.on("-d", "--default FILE", "Argument to use if the stack is empty") do |default| app.default_args = default end opti.on_tail("-h", "--help", "Show this message") do puts opti exit end end end |