Module: MagentoRemote::CLI::Options

Defined in:
lib/bin_helper.rb

Class Method Summary collapse

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.add_shop_options opts, options
  opts.separator "Magento shop options"

  opts.on('-u', '--customer USER',
    'customer/username of shop.') do |u|
    options[:user] = u
  end

  opts.on('-p', '--password PASSWORD',
    'password of customer account.') do |p|
    options[:pass] = p
  end

  opts.on('-b', '--base-uri URI',
    'base URI of shop.') do |b|
    options[: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! options
  if !options[:user] || !options[:pass] || !options[:base_uri]
    STDERR.puts "Error: You have to define user, pass and base_uri.  (see --help)"
    exit 1
  end
end