class Parser

Public Class Methods

parse(options) click to toggle source
# File bin/active_gfx, line 11
def self.parse(options)
  args = Options.new()

  opt_parser = OptionParser.new do |opts|
    opts.banner = "Usage: active_gfx [options]"

    opts.on("-a", "--all", "Shows all graphics chips instead of only in use") do |a|
      args.all = a
    end

    opts.on("-p", "--pretty", "Print the pretty name of graphics card instead of model identifier") do |p|
      args.pretty = p
    end

    opts.on("-h", "--help", "Prints this help") do
      puts opts
      exit
    end

    opts.on("-v", "--version", "Show version") do
      puts Version
      exit
    end
  end

  opt_parser.parse!(options)
  return args
end