Class: Giturl::CommandGiturl
- Inherits:
-
Object
- Object
- Giturl::CommandGiturl
- Defined in:
- lib/command_giturl.rb
Overview
command line wrapper
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
12 13 14 |
# File 'lib/command_giturl.rb', line 12 def params @params end |
Instance Method Details
#parse_options ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/command_giturl.rb', line 14 def @params = {} OptionParser.new do |opts| opts = (opts) opts.parse!(ARGV, into: @params) @params[:open] = true if @params.key?(:app) end end |
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/command_giturl.rb', line 23 def run ARGV << '.' if ARGV.empty? ARGV.each do |arg| if Giturl.git_managed?(arg) url = Giturl.convert(arg) print "#{url}\n" browser_open(url) if @params[:open] elsif @params[:verbose] print "Not git-managed-dir: #{arg}\n" end end end |