Class: Changit::CLI
- Inherits:
-
Object
- Object
- Changit::CLI
- Defined in:
- lib/changit/cli.rb
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/changit/cli.rb', line 5 def initialize = {} [:target_paths] = [] opt_parser = OptionParser.new do |opt| opt. = "Usage: changit [OPTIONS]" opt.separator "" opt.separator "Options" opt.on("-s","--source SOURCE","Which gitconfig file to copy from") do |src_path| [:src_path] = src_path end opt.on("-t","--target TARGET","Which directory to copy the config to."\ " To copy to different directories, pass more than one -t argument each for one directory" ) do |target_path| [:target_paths] << target_path end opt.on("-v","--version","Show version number") do puts Changit::VERSION exit end opt.on("-h","--help","Show CLI options") do puts opt_parser exit end end opt_parser.parse! [:target_paths] = nil if [:target_paths].empty? end |