Class: Popo::OptParse
- Inherits:
-
Object
- Object
- Popo::OptParse
- Includes:
- Constants
- Defined in:
- lib/popo/opt_parse.rb
Constant Summary
Constants included from Constants
Constants::COLOR_GREEN, Constants::COLOR_NONE, Constants::COLOR_RED, Constants::COLOR_YELLOW, Constants::DEFAULT_CONFIG_FILE, Constants::DEFAULT_POPO_TARGET, Constants::POPORC, Constants::POPO_COMMANDS, Constants::POPO_CONFIG, Constants::POPO_DIR_KEY, Constants::POPO_KEY_VALUES, Constants::POPO_WORK_PATH, Constants::POPO_YML_FILE, Constants::POST_INSTALL_NOTE, Constants::REQUIRED_COMMANDS
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#optparse ⇒ Object
readonly
Returns the value of attribute optparse.
Instance Method Summary collapse
-
#initialize ⇒ OptParse
constructor
A new instance of OptParse.
Constructor Details
#initialize ⇒ OptParse
Returns a new instance of OptParse.
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/popo/opt_parse.rb', line 9 def initialize @options = {} @options[:verbose] = false @optparse = OptionParser.new do || . = "Usage: popo COMMAND [options]" .separator "" .separator "Commands: #{POPO_COMMANDS.join(',')}" .separator "" .separator "options:" .on('-p', '--path PATH', 'Target path') do |path| @options[:path] = path end .on('-t', '--target TARGET', 'Deployment target') do |target| @options[:target] = target end .on('-u', '--user USER', 'Specify a username for git') do |user| @options[:user] = user end .on('-m', '--manifest MANIFEST', 'Specify a manifest repo') do |manifest| @options[:manifest] = manifest end .on('-l', '--location LOCATION', 'Set the deployment location') do |location| @options[:location] = location end .on('-r', '--reset', 'WARNING: It will not stash changes') do @options[:reset] = true end .on('-v', '--verbose', 'Prints more info about what you executed') do @options[:verbose] = true end .on('-V', '--version', 'Show popo\'s current version') do puts Popo::VERSION exit end .on('-h', '--help', 'Display this screen') do puts exit end end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/popo/opt_parse.rb', line 7 def @options end |
#optparse ⇒ Object (readonly)
Returns the value of attribute optparse.
7 8 9 |
# File 'lib/popo/opt_parse.rb', line 7 def optparse @optparse end |