Sha256: 3cfe114efe9c4fdc912f41e032ca5661e8d153ca05fa3d23c926aac1af753cbe

Contents?: true

Size: 952 Bytes

Versions: 53

Compression:

Stored size: 952 Bytes

Contents

require 'optparse'
require 'logger'

begin
  OptionParser.new do |opts|
    opts.banner = "Usage: zendesk c[onsole] [options]"

    opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
      config["logger.level"] = v ? Logger::INFO : Logger::WARN
    end

    opts.on("-c", "--config FILE", "Load a config file") do |c|
      config.replace(YAML.load_file(c))
    end

    opts.on("-u", "--username USER", "Sets basic auth username") do |u|
      config["username"] = u
    end

    opts.on("-p", "--password PASS", "Sets basic auth password") do |p|
      config["password"] = p
    end

    opts.on("-a", "--api URL", "Sets api url") do |a|
      config["url"] = a
    end

    opts.on_tail("-h", "--help", "Show this message") do
      puts opts
      exit
    end

    opts.on_tail("--version", "Show version") do
      puts Zendesk::VERSION
      exit
    end
  end.parse!
rescue OptionParser::MissingArgument => e
  puts e.message
  exit
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
zendesk_api-1.1.2 lib/zendesk_api/console/options.rb
zendesk_api-1.1.1 lib/zendesk_api/console/options.rb
zendesk_api-1.1.0 lib/zendesk_api/console/options.rb
zendesk_api-1.0.7 lib/zendesk_api/console/options.rb
zendesk_api-1.0.6 lib/zendesk_api/console/options.rb
zendesk_api-1.0.5 lib/zendesk_api/console/options.rb
zendesk_api-1.0.4 lib/zendesk_api/console/options.rb
zendesk_api-1.0.3 lib/zendesk_api/console/options.rb
zendesk_api-1.0.2 lib/zendesk_api/console/options.rb
zendesk_api-1.0.1 lib/zendesk_api/console/options.rb
zendesk_api-1.0.0 lib/zendesk_api/console/options.rb
zendesk_api-0.3.13 lib/zendesk_api/console/options.rb
zendesk_api-0.3.12 lib/zendesk_api/console/options.rb
zendesk_api-0.4.0.rc3 lib/zendesk_api/console/options.rb
zendesk_api-0.4.0.rc2 lib/zendesk_api/console/options.rb
zendesk_api-0.3.11 lib/zendesk_api/console/options.rb
zendesk_api-0.3.10 lib/zendesk_api/console/options.rb
zendesk_api-0.3.9 lib/zendesk_api/console/options.rb
zendesk_api-0.3.8 lib/zendesk_api/console/options.rb
zendesk_api-0.4.0.rc1 lib/zendesk_api/console/options.rb