Last active
December 15, 2015 05:08
-
-
Save 100lp/5206369 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
programname = "Carbounkel" | |
VERSION = "0.0.1" | |
puts "#{programname} #{VERSION}" | |
puts " | |
1. task | |
2. datatask | |
3. new task | |
0. exit | |
" | |
file = File.open("todo.txt", 'a+') | |
create_date = file.gets.chomp | |
date = Date.parse(create_date) | |
menuchoice = gets.chomp.to_i | |
case menuchoice | |
when 1 | |
file.each_line do |line| | |
taskdate, task = line.split(' - ', 2) | |
puts "#{date += taskdate.to_i} - #{task}" | |
end | |
when 2 | |
puts create_date | |
when 3 | |
puts "Write ur task plz" | |
newtask = gets.chomp | |
retry_message = nil | |
begin | |
puts retry_message || "Write a number of days to ur task plz" | |
newtaskdate = gets.chomp.to_i | |
retry_message = 'Plz, sudar, write number again' | |
end while newtaskdate <= 0 | |
file.puts("#{newtaskdate} - #{newtask}") | |
when 0 | |
puts "the programm was closed" | |
else | |
puts "error at work" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment