Class: Giturl::CommandGiturl
- Inherits:
-
Object
- Object
- Giturl::CommandGiturl
- Defined in:
- lib/command_giturl.rb
Overview
The giturl command: the directories named on the command line, and what the user asked to have done with them.
Instance Attribute Summary collapse
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize ⇒ CommandGiturl
constructor
A new instance of CommandGiturl.
-
#parse_options ⇒ Hash
The options given on the command line.
-
#run ⇒ Object
Prints a URL per target directory, and opens each in a browser when asked.
Constructor Details
#initialize ⇒ CommandGiturl
15 16 17 18 |
# File 'lib/command_giturl.rb', line 15 def initialize = Options.new @params = {} end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
13 14 15 |
# File 'lib/command_giturl.rb', line 13 def params @params end |
Instance Method Details
#parse_options ⇒ Hash
21 22 23 |
# File 'lib/command_giturl.rb', line 21 def @params = .parse!(ARGV) end |
#run ⇒ Object
Prints a URL per target directory, and opens each in a browser when asked. With no target given, the current directory is the target.
27 28 29 30 |
# File 'lib/command_giturl.rb', line 27 def run ARGV << '.' if ARGV.empty? ARGV.each { |target| show(target) } end |