Sha256: afec69a8df0b459c55a41c18beacfd6350196635011c685398be601e4215f822
Contents?: true
Size: 941 Bytes
Versions: 2
Compression:
Stored size: 941 Bytes
Contents
require 'optparse' class Jobim::CLI attr_reader :parser, :options def self.run!(*args, &opts) cli = Jobim::CLI.new begin cli.parse(args) cli.options rescue puts cli.help exit end end def options @options ||= { :dir => Dir.pwd } end def parser @parser ||= OptionParser.new do |o| o.banner = "jobim - TODO: FINISH ME" o.separator "" o.separator "Usage: jobim [OPTION]... [DIRECTORY]" o.separator "" # o.separator "Specific options:" # o.separator "" o.separator "General options:" o.on "-h", "--help", "Display this help message." do puts help exit end o.on "--version", "Display the version number" do options[:version] = Jobim::VERSION puts options[:version] exit end end end def parse(args) parser.parse!(args) end def help parser.to_s end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jobim-0.1.1 | lib/jobim/cli.rb |
jobim-0.1.0 | lib/jobim/cli.rb |