Class: Rgit::Cli
Constant Summary collapse
- SUB_COMMANDS =
%w(add-root remove-root show-roots checkout pull fetch status version).freeze
Constants included from Rgit
Instance Method Summary collapse
-
#initialize(rgit) ⇒ Cli
constructor
A new instance of Cli.
- #parse(args) ⇒ Object
Constructor Details
#initialize(rgit) ⇒ Cli
Returns a new instance of Cli.
9 10 11 |
# File 'lib/rgit/cli.rb', line 9 def initialize(rgit) @rgit = rgit end |
Instance Method Details
#parse(args) ⇒ Object
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 40 |
# File 'lib/rgit/cli.rb', line 13 def parse(args) parser = rgit_argument_parser global_opts = (parser, args) @rgit.verbose = global_opts[:verbose] cmd = args.shift case cmd when 'add-root' add_root(args) when 'remove-root' remove_root(args) when 'checkout' checkout(args) when 'show-roots' show_roots(args) when 'pull' pull(args) when 'fetch' fetch(args) when 'status' status(args) when 'version' puts "rgit #{VERSION}" else puts I18n.t('rgit.unknown_subcommand', command: cmd).red end end |