Skip to content

Commit

Permalink
Improved arg parsing for gitlab readline shell. Other small fixes/imp…
Browse files Browse the repository at this point in the history
…rovements on regexes.
  • Loading branch information
asedge committed Jul 29, 2014
1 parent f8f3715 commit 916e8a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/gitlab/client/repositories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def tags(project, options={})
# Creates a new project repository tag.
#
# @example
# Gitlab.create_tag(42,'new_tag','master'))
# Gitlab.create_tag(42,'new_tag','master')
#
# @param [Integer] project The ID of a project.
# @param [String] tag_name The name of the new tag.
Expand Down
4 changes: 2 additions & 2 deletions lib/gitlab/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def self.get_help(methods,cmd=nil)
ri_output = `#{ri_cmd} -T #{namespace} 2>&1`.chomp

if $? == 0
ri_output.gsub!(/#{cmd}\((.*)\)/, cmd+' \1')
ri_output.gsub!(/#{cmd}\((.*?)\)/, cmd+' \1')
ri_output.gsub!(/Gitlab\./, 'gitlab> ')
ri_output.gsub!(/Gitlab\..+$/, '')
ri_output.gsub!(/\,/, '')
ri_output.gsub!(/\,\s?/, ' ')
help = ri_output
else
help = "Ri docs not found for #{namespace}, please install the docs to use 'help'"
Expand Down
2 changes: 1 addition & 1 deletion lib/gitlab/shell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.start
next if buf.nil? || buf.empty?
break if buf == 'exit'

buf = buf.split.map(&:chomp)
buf = buf.scan(/["][^"]+["]|\S+/).map { |word| word.gsub(/^['"]|['"]$/,'') }
cmd = buf.shift
args = buf.count > 0 ? buf : []

Expand Down

0 comments on commit 916e8a7

Please sign in to comment.