Module: MagentoRemote::CLI::Options
- Defined in:
- lib/bin_helper.rb
Class Method Summary collapse
-
.add_shop_options(opts, options) ⇒ Object
Register customer, password and base-uri options.
-
.exit_obligatory!(options) ⇒ Object
Exit if obligatory options not given.
Class Method Details
.add_shop_options(opts, options) ⇒ Object
Register customer, password and base-uri options.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bin_helper.rb', line 6 def self. opts, opts.separator "Magento shop options" opts.on('-u', '--customer USER', 'customer/username of shop.') do |u| [:user] = u end opts.on('-p', '--password PASSWORD', 'password of customer account.') do |p| [:pass] = p end opts.on('-b', '--base-uri URI', 'base URI of shop.') do |b| [:base_uri] = b end end |
.exit_obligatory!(options) ⇒ Object
Exit if obligatory options not given.
26 27 28 29 30 31 |
# File 'lib/bin_helper.rb', line 26 def self.exit_obligatory! if ![:user] || ![:pass] || ![:base_uri] STDERR.puts "Error: You have to define user, pass and base_uri. (see --help)" exit 1 end end |