Skip to content

Instantly share code, notes, and snippets.

@scottswezey
Created August 6, 2010 23:59
Show Gist options
  • Save scottswezey/512234 to your computer and use it in GitHub Desktop.
Save scottswezey/512234 to your computer and use it in GitHub Desktop.
require 'TodoList'
class App
def self.file_choser
puts "Enter a filename to use:"
gets.chomp
end
def self.main
file = file_choser
list = TodoList.new(file)
puts list
begin
puts "Input: "
input = gets.chomp
parts = input.split(' ').compact
command = parts.shift
case command
when "show"
puts list
when "add"
list.add parts.first
puts "'#{parts.first}' added to todo list."
when "save"
list.write
puts "List saved to file: #{list.file}"
else
puts "Command: #{command} is not implemented."
end
end while not input.empty?
list.write
puts "Goodbye."
end
end
App.main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment