Sha256: 2175bd3941c9e937573e0c694e123a5644f66809ca16f20c168d5d4234678201
Contents?: true
Size: 777 Bytes
Versions: 1
Compression:
Stored size: 777 Bytes
Contents
require 'optparse' require 'ostruct' require_relative 'hg' module HGTK class Parser def self.run **kwargs # :argv is a convenience to override ARGV, like for testing. args = kwargs.fetch :argv, ARGV # Command line options. options = OpenStruct.new \ recursive: false OptionParser.new do |opts| opts.banner = "Usage: hgtk [options] command" opts.on '-h', '--help', 'Display this help screen.' do puts opts exit end opts.on '-r', 'Search recursively.' do |v| options.recursive = true end end.parse! args command = args.last # HGTK::Hg.new args.last, **options.to_h end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hgtk-0.1.0 | lib/hgtk/parser.rb |