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.2.10 lib/zendesk_api/console/options.rb
zendesk_api-1.2.9 lib/zendesk_api/console/options.rb
zendesk_api-0.3.14 lib/zendesk_api/console/options.rb
zendesk_api-1.2.8 lib/zendesk_api/console/options.rb
zendesk_api-1.3.5 lib/zendesk_api/console/options.rb
zendesk_api-1.2.7 lib/zendesk_api/console/options.rb
zendesk_api-1.3.4 lib/zendesk_api/console/options.rb
zendesk_api-1.3.2 lib/zendesk_api/console/options.rb
zendesk_api-1.3.1 lib/zendesk_api/console/options.rb
zendesk_api-1.3.0 lib/zendesk_api/console/options.rb
zendesk_api-1.3.0.rc3 lib/zendesk_api/console/options.rb
zendesk_api-1.2.6 lib/zendesk_api/console/options.rb
zendesk_api-1.3.0.rc2 lib/zendesk_api/console/options.rb
zendesk_api-1.3.0.rc1 lib/zendesk_api/console/options.rb
zendesk_api-1.2.5 lib/zendesk_api/console/options.rb
zendesk_api-1.2.4 lib/zendesk_api/console/options.rb
zendesk_api-1.2.3 lib/zendesk_api/console/options.rb
zendesk_api-1.2.2 lib/zendesk_api/console/options.rb
zendesk_api-1.2.1 lib/zendesk_api/console/options.rb
zendesk_api-1.1.3 lib/zendesk_api/console/options.rb