Permalink
Browse files

an alternate place to correct the menu layout

  • Loading branch information...
1 parent 5786c69 commit 6f60b6102ccd73b6305231f222ab7fc92010d7dd @drnic drnic committed Nov 4, 2009
Showing with 6 additions and 7 deletions.
  1. +1 −4 lib/commands/commands.rb
  2. +3 −1 lib/github/ui.rb
  3. +2 −2 spec/ui_spec.rb
@@ -136,10 +136,7 @@
repo_list = repos.map do |r|
{ "name" => "#{r['username']}/#{r['name']}", "description" => r['description'] }
end
- formatted_list = []
- helper.format_list(repo_list).split("\n").each_with_index do |item, i|
- formatted_list << ((i < 9) ? " " + item : item)
- end
+ formatted_list = helper.format_list(repo_list).split("\n")
if user_repo = GitHub::UI.display_select_list(formatted_list)
user, repo = user_repo.split('/', 2)
end
View
@@ -8,7 +8,9 @@ module UI
def display_select_list(list)
HighLine.track_eof = false
long_result = HighLine.new.choose do |menu|
- list.each { |item| menu.choice item }
+ list.each_with_index do |item, i|
+ menu.choice((i < 9) ? " #{item}" : item)
+ end
menu.header = "Select a repository to clone"
end
long_result && long_result.gsub(/\s+#.*$/,'')
View
@@ -360,8 +360,8 @@
']}'
json.rewind
question_list = <<-LIST.gsub(/^ /, '').split("\n").compact
- defunkt/github-gem # The official `github` command line helper for simplifying your GitHub experience.
- pjhyett/github-gem-builder # The scripts used to build RubyGems on GitHub
+ defunkt/github-gem # The official `github` command line helper for simplifying your GitHub experience.
+ pjhyett/github-gem-builder # The scripts used to build RubyGems on GitHub
LIST
@command.should_receive(:open).with("http://github.com/api/v1/json/search/github-gem").and_return(json)
GitHub::UI.should_receive(:display_select_list).with(question_list).

0 comments on commit 6f60b61

Please sign in to comment.