Module: GitHub::UI

Extended by:
UI
Included in:
UI
Defined in:
lib/github/ui.rb

Instance Method Summary collapse

Instance Method Details

#display_select_list(list) ⇒ Object

Take a list of items, including optional ‘ # some description’ on each and return the selected item (without the description)



9
10
11
12
13
14
15
16
17
18
# File 'lib/github/ui.rb', line 9

def display_select_list(list)
  HighLine.track_eof = false
  long_result = HighLine.new.choose do |menu|
    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+#.*$/,'').gsub(/^\ /,'')
end