Skip to content

Instantly share code, notes, and snippets.

@kmandreza
Created June 22, 2012 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmandreza/2969565 to your computer and use it in GitHub Desktop.
Save kmandreza/2969565 to your computer and use it in GitHub Desktop.
ToDo List
require 'docopt'
class Todo
def initialize
puts "Generating 'To Do' list"
@file = File.open("todo_list.txt", 'w+')
puts "'To Do' list generated"
end
def task(text)
end
def append(task)
@file << (task + "\n")
end
def prepend
end
def delete
end
def mark_complete
end
def display_outstanding_task
end
def display_completed_task
end
end
doc = "Usage: todo.rb [options]
-h --help Show this.
-a --append Append an item to your task list
-p --prepend Preprend an item to your task list
-c --complete Mark a specific item from your list as complete
-o --outstanding Show outstanding tasks by creation date
-C --Completed Show competed items by completion date
-d --delete Delete an item from your task list
-v --verbose Print more text.
--quiet Print less text.
-O FILE Specify output file [default: ./test.txt]"
options = Docopt(doc, version=nil, help=true)
options['--help']
if options['-a'] # Appends the task to the task list
# puts ARGV.inspect
# puts ARGV.class
# puts "You called -a"
task_list = Todo.new
task_list.append(ARGV)
end
if options['--quiet']
end
# kharas_list = Todo.new
# kharas_list.append('wash the car')
# kharas_list.append('clean the house')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment