Class: Giturl::CommandGiturl

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeCommandGiturl



15
16
17
18
# File 'lib/command_giturl.rb', line 15

def initialize
  @options = Options.new
  @params = {}
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



13
14
15
# File 'lib/command_giturl.rb', line 13

def params
  @params
end

Instance Method Details

#parse_optionsHash



21
22
23
# File 'lib/command_giturl.rb', line 21

def parse_options
  @params = @options.parse!(ARGV)
end

#runObject

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