Compare commits

...

9 Commits

Author SHA1 Message Date
Arthur Poulet 327acf8078
migrate 2019-02-18 12:10:40 +01:00
Arthur POULET 69dbf17a3e
Update readme 2018-12-02 12:11:27 +01:00
Arthur POULET d87acadb37
Update version 2018-09-22 23:45:56 +02:00
Arthur POULET 2337888f47
Update to crystal 0.26.1 2018-09-22 23:44:42 +02:00
Arthur POULET 0f2b1ca225
Merge branch 'develop' 2018-04-27 01:04:26 +02:00
Arthur POULET 0b4f5ef753
Update version and add --version 2018-04-27 01:03:30 +02:00
Arthur POULET efd327e9dd
Rename Todo::Todo to Todo::Task 2018-04-27 01:00:57 +02:00
Arthur POULET 0531035755
Merge remote-tracking branch 'Jens0512/patch-1' into develop 2017-12-18 00:36:34 +01:00
Jens ca20fef018
Remove duplicate require 2017-12-17 18:17:38 +01:00
8 changed files with 19 additions and 14 deletions

View File

@ -11,12 +11,14 @@ release:
test:
crystal spec
deps:
crystal deps install
shards install
deps_update:
crystal deps update
shards update
deps_opt:
@[ -d lib/ ] || make deps
doc:
crystal docs
clean:
rm $(NAME)
.PHONY: all run build release test deps deps_update doc
.PHONY: all run build release test deps deps_update clean doc

View File

@ -1,3 +1,5 @@
**Migrated to <https://git.sceptique.eu/Sceptique/todo>**
# todo
track your todo lists in your terminal
@ -6,7 +8,7 @@ track your todo lists in your terminal
### Requirements
- crystal (see the shards.yml file)
- crystal (see the shards.yml file) (tested with v0.27.0)
- shards
### Build

View File

@ -1,5 +1,5 @@
name: todo
version: 0.2.1
version: 1.0.1
authors:
- Arthur Poulet <arthur.poulet@mailoo.org>
@ -8,6 +8,6 @@ targets:
todo:
main: src/todo.cr
crystal: 0.20.5
crystal: 0.24.2
license: GPL-3.0

View File

@ -24,6 +24,7 @@ parsed = OptionParser.parse! do |p|
p.on("-s", "--sort", "Sort by date (by default)") { sort = :date }
p.on("-i", "--sort-id", "Sort by id") { sort = :id }
p.on("-v", "--version", "Show version") { puts "Todo v#{Todo::VERSION}"; exit }
p.on("-h", "--help", "Show this help") { puts p; exit }
end
Dir.mkdir_p(dir_name)

View File

@ -1,5 +1,4 @@
require "yaml"
require "yaml"
class Todo::Config
FILE_PATH = File.expand_path ".config/todorc", ENV["HOME"]

View File

@ -1,6 +1,7 @@
require "colorize"
require "./todo"
require "./task"
require "./list"
require "./config"
module Todo::Exec
extend self
@ -29,14 +30,14 @@ module Todo::Exec
# Execute the operation
case mode
when :add
todo = ::Todo::Todo.new(msg, date)
todo = ::Todo::Task.new(msg, date)
list << todo
puts "ADD [#{list.size - 1}] #{todo.date} #{todo.msg}"
when :list
display = [] of Array(String)
list.each_with_index do |todo, idx|
p_id = idx.to_s.rjust(4, ' ').colorize.yellow
p_date_time = Time.parse(todo.date, ::Todo::Todo::DATE_FORMAT) rescue nil
p_date_time = Time.parse_local(todo.date, ::Todo::Task::DATE_FORMAT) rescue nil
p_date_red = p_date_time && p_date_time < Time.now
p_date = todo.date.rjust(12, ' ').colorize.fore(p_date_red ? :red : :white).mode(p_date_red ? :bright : :dim).to_s
display << [todo.date, "#{p_id} | #{p_date} | #{todo.msg}"]

View File

@ -1,5 +1,5 @@
require "yaml"
require "./todo"
require "./task"
class Todo::List
def self.load(path : String)
@ -14,7 +14,7 @@ class Todo::List
property name
YAML.mapping(
todos: {type: Array(Todo), setter: false, nilable: false},
todos: {type: Array(Todo::Task), setter: false, nilable: false},
)
def save(list_name : String, dir_name : String)
@ -26,7 +26,7 @@ class Todo::List
self
end
def <<(todo : Todo)
def <<(todo : Todo::Task)
self.todos << todo
end

View File

@ -1,6 +1,6 @@
require "yaml"
class Todo::Todo
class Todo::Task
YAML.mapping(
msg: {type: String},
date: {type: String, setter: false},