Picking up idea from one of the forks, since it seems he abandoned it, but i still think it makes sense.
Not sure if once fully migrated to TTY it will still be valid, but its a good point:
def list_pivotal_stories api_key, project_id
PivotalTracker::Client.token = api_key
project = PivotalTracker::Project.find(project_id.to_i)
stories = project.stories.all({current_state: :started})
stories.each_with_index{|s,i| puts "[#{i+1}] ##{s.id} : #{s.name}"}
puts '[0] Exit'
stories
end
def select_story stories
story_selection = nil
while story_selection == nil or story_selection > stories.length + 1
puts "invalid selection" if story_selection != nil
story_selection = readline("Select a story: ", Range.new(1,stories.length).to_a.map(&:to_s)).to_i
end
if story_selection == 0
puts 'Exiting...'
exit
end
story = stories[story_selection - 1]
puts "Selected : ##{story.id} : #{story.name}"
return story
end