todd 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.md +137 -0
- data/Manifest +24 -0
- data/Rakefile +20 -0
- data/Readme.md +84 -0
- data/TODO +12 -0
- data/bin/todd +145 -0
- data/bin/todd.rb +145 -0
- data/bin/todd_old.rb +161 -0
- data/db/database.yml +2 -0
- data/db/migrations/0214102019_initialize_database.rb +48 -0
- data/db/migrations/0221102255_add_punch_table.rb +28 -0
- data/db/migrations/0222102121_remove_archived_tasks.rb +19 -0
- data/db/migrations/0222102124_add_archived_column_to_tasks.rb +15 -0
- data/db/todd.db +0 -0
- data/lib/todd.rb +10 -0
- data/lib/todd/config.rb +67 -0
- data/lib/todd/model.rb +254 -0
- data/lib/todd/util.rb +151 -0
- data/lib/todd/version.rb +3 -0
- data/tasks/enviroment.rake +5 -0
- data/tasks/migrate.rake +4 -0
- data/tasks/migration.rake +17 -0
- data/tasks/revert.rake +5 -0
- data/tasks/revert_db.rake +7 -0
- data/todd.gemspec +43 -0
- metadata +138 -0
data/History.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
commit 83697d83ada204efa36f1671365ff57148f69634
|
|
2
|
+
Author: Carl Sverre <carl@icehouse.(none)>
|
|
3
|
+
Date: Mon Feb 22 17:42:25 2010 -0800
|
|
4
|
+
|
|
5
|
+
More commander implementation, lots of bug fixes and api changes
|
|
6
|
+
|
|
7
|
+
commit f9832591a16c7ac4e261b907e39f213ac9c30b9a
|
|
8
|
+
Author: Carl Sverre <carl@iced.(none)>
|
|
9
|
+
Date: Mon Feb 22 00:12:33 2010 -0800
|
|
10
|
+
|
|
11
|
+
BROKEN COMMIT :: Moving to Gem module dir format
|
|
12
|
+
|
|
13
|
+
New dir layout
|
|
14
|
+
In process of migrating todd to use Vision Media's commander gem
|
|
15
|
+
In process of making this gem friendly
|
|
16
|
+
|
|
17
|
+
commit aa377f13fd01481b0ebaf1c6a374f3f95addd1a4
|
|
18
|
+
Author: Carl Sverre <carl@iced.(none)>
|
|
19
|
+
Date: Sun Feb 21 23:45:08 2010 -0800
|
|
20
|
+
|
|
21
|
+
Migrated to using punches for each task session
|
|
22
|
+
|
|
23
|
+
commit 52197836deda170dc6876b9dd9795a81e688a086
|
|
24
|
+
Author: Carl Sverre <carl@iced.(none)>
|
|
25
|
+
Date: Sun Feb 21 21:12:17 2010 -0800
|
|
26
|
+
|
|
27
|
+
New 'minimal' output style added along with a new time_span formatter and some bug fixes
|
|
28
|
+
|
|
29
|
+
commit c7808169e5944c94482abe0ffabdc29be99745ed
|
|
30
|
+
Author: Carl Sverre <carl@iced.(none)>
|
|
31
|
+
Date: Sun Feb 21 18:06:55 2010 -0800
|
|
32
|
+
|
|
33
|
+
Fixed activerecord migration and some rakefile bugs
|
|
34
|
+
|
|
35
|
+
commit a767e9552eb7e1ebce9e24f7b13e56502eed8ddb
|
|
36
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
37
|
+
Date: Sat Feb 20 20:00:35 2010 -0800
|
|
38
|
+
|
|
39
|
+
Lots of changes to do with formatting
|
|
40
|
+
|
|
41
|
+
* Refactored the outputter into todd_util
|
|
42
|
+
* Added visionmedia's terminal-table for nice outputting
|
|
43
|
+
|
|
44
|
+
commit 75a9bd1dd143240c794700368940a442c21ec0bf
|
|
45
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
46
|
+
Date: Mon Feb 15 01:18:32 2010 -0800
|
|
47
|
+
|
|
48
|
+
YAML is included by default
|
|
49
|
+
|
|
50
|
+
commit de6c379a222dbe4737e114bffb088125e5a674b2
|
|
51
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
52
|
+
Date: Mon Feb 15 01:17:18 2010 -0800
|
|
53
|
+
|
|
54
|
+
Moving from ruby config to YAML config
|
|
55
|
+
|
|
56
|
+
commit 170d7a4a4121389e4b690431eef453b747bc734c
|
|
57
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
58
|
+
Date: Sun Feb 14 20:24:48 2010 -0800
|
|
59
|
+
|
|
60
|
+
Migrated schema to using migrations
|
|
61
|
+
|
|
62
|
+
* Moved the database initialization out of todd_model.rb
|
|
63
|
+
* Added rudimentary Rakefile with support for migrations.
|
|
64
|
+
|
|
65
|
+
commit 6c8de958d1a8a4e1e749c5909645bcedb9f11714
|
|
66
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
67
|
+
Date: Sun Feb 14 00:56:53 2010 -0800
|
|
68
|
+
|
|
69
|
+
Success! Working time tracking system. Very simple, so much development is still needed. Stay tuned for more
|
|
70
|
+
|
|
71
|
+
commit a5a1c54549f83fffedd1b3fcaa2bd33d24c66bf3
|
|
72
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
73
|
+
Date: Sat Feb 13 20:49:11 2010 -0800
|
|
74
|
+
|
|
75
|
+
Working system
|
|
76
|
+
|
|
77
|
+
commit 5552ebd064bb9da442262153903bc5903c2e9e3f
|
|
78
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
79
|
+
Date: Sun Feb 7 15:22:01 2010 -0800
|
|
80
|
+
|
|
81
|
+
Still working on the conversion
|
|
82
|
+
|
|
83
|
+
commit d39799823d3bcd32e8fb6591a89b95027251a58e
|
|
84
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
85
|
+
Date: Sat Feb 6 15:01:40 2010 -0800
|
|
86
|
+
|
|
87
|
+
Half migrated to activerecord
|
|
88
|
+
|
|
89
|
+
commit fe67c559726d60c98025be38e8dcd354ea8f0317
|
|
90
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
91
|
+
Date: Sat Feb 6 12:51:43 2010 -0800
|
|
92
|
+
|
|
93
|
+
Last commit before moving to activerecord
|
|
94
|
+
|
|
95
|
+
commit bf1e4e77ff5e174d2c4032603ed4e514fffc1d7a
|
|
96
|
+
Author: Carl Sverre <carl@rain.(none)>
|
|
97
|
+
Date: Fri Feb 5 01:55:17 2010 -0800
|
|
98
|
+
|
|
99
|
+
Lots of changes, mostly trying to get a feel...
|
|
100
|
+
|
|
101
|
+
...for ruby and this program.
|
|
102
|
+
|
|
103
|
+
commit f3314dabcdd0c5d6a6857fee3f09a7a1a24f6898
|
|
104
|
+
Author: Carl Sverre <carl@icehouse.(none)>
|
|
105
|
+
Date: Thu Feb 4 17:06:50 2010 -0800
|
|
106
|
+
|
|
107
|
+
Added basic framework
|
|
108
|
+
|
|
109
|
+
commit 0c80cdd49347c1a508784722b52e40dfdb3abfcd
|
|
110
|
+
Author: Carl Sverre <carl@iced.(none)>
|
|
111
|
+
Date: Wed Feb 3 23:26:58 2010 -0800
|
|
112
|
+
|
|
113
|
+
adding horizontal rules
|
|
114
|
+
|
|
115
|
+
commit 7bb70d7f31182024424bfc11811a79e58867c6fa
|
|
116
|
+
Author: Carl Sverre <carl@iced.(none)>
|
|
117
|
+
Date: Wed Feb 3 23:24:16 2010 -0800
|
|
118
|
+
|
|
119
|
+
Fixing readme
|
|
120
|
+
|
|
121
|
+
commit 94748ade8222c168a0d1d2cd91aa277ad0d5fde3
|
|
122
|
+
Author: Carl Sverre <carl@iced.(none)>
|
|
123
|
+
Date: Wed Feb 3 23:23:19 2010 -0800
|
|
124
|
+
|
|
125
|
+
Readme added
|
|
126
|
+
|
|
127
|
+
commit 645d076e03e77d7a13e00b800e0566a95426670d
|
|
128
|
+
Author: Carl Sverre <carl@iced.(none)>
|
|
129
|
+
Date: Wed Feb 3 23:22:56 2010 -0800
|
|
130
|
+
|
|
131
|
+
Readme added
|
|
132
|
+
|
|
133
|
+
commit 3b7ebb8daaaad24ff6312de584331f152196895c
|
|
134
|
+
Author: Stephen Sugden <grncdr@uvic.ca>
|
|
135
|
+
Date: Wed Jan 27 11:54:15 2010 -0800
|
|
136
|
+
|
|
137
|
+
added empty files
|
data/Manifest
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
History.md
|
|
2
|
+
Manifest
|
|
3
|
+
Rakefile
|
|
4
|
+
Readme.md
|
|
5
|
+
TODO
|
|
6
|
+
bin/todd
|
|
7
|
+
bin/todd.rb
|
|
8
|
+
bin/todd_old.rb
|
|
9
|
+
db/database.yml
|
|
10
|
+
db/migrations/0214102019_initialize_database.rb
|
|
11
|
+
db/migrations/0221102255_add_punch_table.rb
|
|
12
|
+
db/migrations/0222102121_remove_archived_tasks.rb
|
|
13
|
+
db/migrations/0222102124_add_archived_column_to_tasks.rb
|
|
14
|
+
db/todd.db
|
|
15
|
+
lib/todd.rb
|
|
16
|
+
lib/todd/config.rb
|
|
17
|
+
lib/todd/model.rb
|
|
18
|
+
lib/todd/util.rb
|
|
19
|
+
lib/todd/version.rb
|
|
20
|
+
tasks/enviroment.rake
|
|
21
|
+
tasks/migrate.rake
|
|
22
|
+
tasks/migration.rake
|
|
23
|
+
tasks/revert.rake
|
|
24
|
+
tasks/revert_db.rake
|
data/Rakefile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
$:.unshift 'lib'
|
|
2
|
+
|
|
3
|
+
require 'todd'
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'rake'
|
|
6
|
+
require 'highline/import'
|
|
7
|
+
require 'echoe'
|
|
8
|
+
|
|
9
|
+
Echoe.new 'todd', Todd::VERSION do |p|
|
|
10
|
+
p.author = "Carl Sverre"
|
|
11
|
+
p.email = "carl@carlsverre.com"
|
|
12
|
+
p.summary = "A simple time-tracking todo-list for the command line."
|
|
13
|
+
p.url = "http://github.com/uvic-sdo/todd"
|
|
14
|
+
p.runtime_dependencies << 'commander >=4.0.2'
|
|
15
|
+
p.runtime_dependencies << 'active_record >=2.3.5'
|
|
16
|
+
p.runtime_dependencies << 'terminal_table >=1.4.2'
|
|
17
|
+
p.runtime_dependencies << 'json >=1.2.0'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Dir['tasks/**/*.rake'].sort.each { |f| load f }
|
data/Readme.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
Todd
|
|
2
|
+
====
|
|
3
|
+
|
|
4
|
+
Powerful todo-list action at your fingertips.
|
|
5
|
+
|
|
6
|
+
Contribution
|
|
7
|
+
============
|
|
8
|
+
|
|
9
|
+
Right now Todd is still in its growth stages, so if you are interested
|
|
10
|
+
in contributing be aware that any part of the Todd api could change at any
|
|
11
|
+
moment.
|
|
12
|
+
|
|
13
|
+
Commands
|
|
14
|
+
--------
|
|
15
|
+
|
|
16
|
+
$ todd init
|
|
17
|
+
|
|
18
|
+
Initialize a todd todo list in the local directory.
|
|
19
|
+
|
|
20
|
+
-------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
$ todd add-remote <not implemented>
|
|
23
|
+
|
|
24
|
+
Add a connection to a remote todo list.
|
|
25
|
+
|
|
26
|
+
-------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
$ todd sync <not implemented>
|
|
29
|
+
|
|
30
|
+
Sync to a remote todo list.
|
|
31
|
+
|
|
32
|
+
-------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
$ todd add <string>
|
|
35
|
+
|
|
36
|
+
Add an item to the local todo list. <string> in format:
|
|
37
|
+
|
|
38
|
+
> "Task description #category-optional"
|
|
39
|
+
|
|
40
|
+
-------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
$ todd rm <id>
|
|
43
|
+
|
|
44
|
+
Remove an item from the local todo list. <id> in format:
|
|
45
|
+
|
|
46
|
+
EITHER #relative-id OR <hash>. The relative id is a short id
|
|
47
|
+
which comes up when you use `todd list`, and the <hash> is
|
|
48
|
+
enough of the task's hash to make it unique.
|
|
49
|
+
|
|
50
|
+
-------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
$ todd list
|
|
53
|
+
|
|
54
|
+
List all items (or items from a particular category). Format
|
|
55
|
+
something like:
|
|
56
|
+
|
|
57
|
+
$ todd list
|
|
58
|
+
#1 task text task text task text <9e107d9d372bb6826bd81d3542a419d6>
|
|
59
|
+
#2 lorem ipsum lorem ipsum <dbb804f87fdc6914a7978aae54f5958b>
|
|
60
|
+
|
|
61
|
+
Category:
|
|
62
|
+
#3 a quick brown fox did something <174a904669b71d64ef22c8b22aa80c61>
|
|
63
|
+
$
|
|
64
|
+
|
|
65
|
+
-------------------------------------------------------
|
|
66
|
+
|
|
67
|
+
$ todd find <query>
|
|
68
|
+
|
|
69
|
+
Search all tasks with a certain query. Query format is yet to be decided.
|
|
70
|
+
Output format similar to list.
|
|
71
|
+
|
|
72
|
+
-------------------------------------------------------
|
|
73
|
+
|
|
74
|
+
$ todd start <id>
|
|
75
|
+
|
|
76
|
+
Start the timer on task with id == <id>. <id> in same format as `todd rm`
|
|
77
|
+
|
|
78
|
+
-------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
$ todd stop <id>
|
|
81
|
+
|
|
82
|
+
Stop the timer on task with id == <id>. <id> in same format as `todd rm`
|
|
83
|
+
Outputs session time (time since it started) and total time.
|
|
84
|
+
|
data/TODO
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Todo List:
|
|
2
|
+
|
|
3
|
+
* Todd-Repl to do batch task-management
|
|
4
|
+
* ~/.todd config file for global options, ./.todd for local todo-lists
|
|
5
|
+
* add super simple markdown output formatting for git commit msgs
|
|
6
|
+
* move formatters into their own namespaces and seperate classes
|
|
7
|
+
* todd start --monitor <max_time>
|
|
8
|
+
* add graphs!!!!
|
|
9
|
+
* add test framework
|
|
10
|
+
* add rdoc
|
|
11
|
+
* rewrite readme
|
|
12
|
+
* todd remoting stuff? webserver
|
data/bin/todd
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'commander/import'
|
|
6
|
+
require 'todd'
|
|
7
|
+
|
|
8
|
+
program :version, Todd::VERSION
|
|
9
|
+
program :description, "Todd: Time Tracking
|
|
10
|
+
Todd is a simple todo list manager which has been
|
|
11
|
+
developed with developers in mind. It allows you
|
|
12
|
+
to track how much time you spend on different tasks
|
|
13
|
+
as well as just acting as a dumb task list.
|
|
14
|
+
|
|
15
|
+
Query System:
|
|
16
|
+
Todd provides a simple query system which you can
|
|
17
|
+
use with most of its commands. The system reads
|
|
18
|
+
the following queries for selecting tasks:
|
|
19
|
+
|
|
20
|
+
n : select a single task with id = n
|
|
21
|
+
n..m : select all tasks with id > n AND id < m
|
|
22
|
+
all : select all tasks
|
|
23
|
+
last : select the last task
|
|
24
|
+
active : select all active tasks
|
|
25
|
+
inactive : select all inactive tasks
|
|
26
|
+
|
|
27
|
+
The system currently only supports a single query
|
|
28
|
+
(instead of ANDing multiple queries)
|
|
29
|
+
"
|
|
30
|
+
|
|
31
|
+
default_command :list
|
|
32
|
+
|
|
33
|
+
list = nil # todd initialized after commands
|
|
34
|
+
|
|
35
|
+
global_option('-f', '--format FORMAT', 'Set output formatting for this run') { |format|
|
|
36
|
+
Todd::Base.set_formatting format
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
command :init do |c|
|
|
40
|
+
c.syntax = 'todd init'
|
|
41
|
+
c.summary = 'Initialize Todd'
|
|
42
|
+
c.description = 'Initialize Todd in the current directory'
|
|
43
|
+
c.action do |args, options|
|
|
44
|
+
Todd::Base.init_local_dir
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
command :list do |c|
|
|
49
|
+
c.syntax = 'todd list'
|
|
50
|
+
c.summary = 'List all tasks'
|
|
51
|
+
c.description = 'List all the tasks in the current Todd List'
|
|
52
|
+
c.action do |args, options|
|
|
53
|
+
puts Todd::Util.format_bundle list.bundle
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
alias_command :ls, :list
|
|
57
|
+
|
|
58
|
+
command :find do |c|
|
|
59
|
+
c.syntax = 'todd find [query]'
|
|
60
|
+
c.summary = 'Find tasks matching query'
|
|
61
|
+
c.description = 'Find all tasks which match the query in the current Todd List'
|
|
62
|
+
c.action do |args, options|
|
|
63
|
+
puts Todd::Util.format_bundle list.bundle(args.shift)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
alias_command :f, :find
|
|
67
|
+
|
|
68
|
+
command :add do |c|
|
|
69
|
+
c.syntax = 'todd add [task]'
|
|
70
|
+
c.summary = 'Add a task'
|
|
71
|
+
c.description = 'Add a task to the current Todd List
|
|
72
|
+
[task] can contain a hash-tagged category anywhere if you want
|
|
73
|
+
to place the task in a different category than default'
|
|
74
|
+
c.example 'Add a simple task', 'todd add "Fix Todd version"'
|
|
75
|
+
c.example 'Add a task in category personal', 'todd add "Playing Videogames #personal"'
|
|
76
|
+
c.example 'Add a task in category clients', 'todd add "Working on google.com #clients"'
|
|
77
|
+
c.action do |args, options|
|
|
78
|
+
list.add args.shift
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
alias_command :a, :add
|
|
82
|
+
|
|
83
|
+
command :remove do |c|
|
|
84
|
+
c.syntax = 'todd remove [query]'
|
|
85
|
+
c.summary = 'Remove tasks'
|
|
86
|
+
c.description = 'Remove all tasks which match the query.'
|
|
87
|
+
c.action do |args, options|
|
|
88
|
+
list.rm args.shift
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
alias_command :rm, :remove
|
|
92
|
+
|
|
93
|
+
command :start do |c|
|
|
94
|
+
c.syntax = 'todd start [query]'
|
|
95
|
+
c.summary = 'Start tasks'
|
|
96
|
+
c.description = 'Start all tasks which match the query'
|
|
97
|
+
c.action do |args, options|
|
|
98
|
+
list.start args.shift
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
alias_command :s, :start
|
|
102
|
+
|
|
103
|
+
command :stop do |c|
|
|
104
|
+
c.syntax = 'todd stop [query]'
|
|
105
|
+
c.summary = 'stop tasks'
|
|
106
|
+
c.description = 'stop all tasks which match the query'
|
|
107
|
+
c.action do |args, options|
|
|
108
|
+
list.stop args.shift
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
alias_command :st, :stop
|
|
112
|
+
|
|
113
|
+
command :archive do |c|
|
|
114
|
+
c.syntax = 'todd archive [query]'
|
|
115
|
+
c.summary = 'Archive tasks'
|
|
116
|
+
c.description = 'Archive all tasks which match the query'
|
|
117
|
+
c.action do |args, options|
|
|
118
|
+
list.archive args.shift
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
alias_command :ar, :archive
|
|
122
|
+
|
|
123
|
+
command :restore do |c|
|
|
124
|
+
c.syntax = 'todd restore [query]'
|
|
125
|
+
c.summary = 'Restore tasks'
|
|
126
|
+
c.description = 'Restore all archived tasks matched by query'
|
|
127
|
+
c.action do |args, options|
|
|
128
|
+
list.restore args.shift
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
alias_command :r, :restore
|
|
132
|
+
|
|
133
|
+
command :archived do |c|
|
|
134
|
+
c.syntax = 'todd archived [query]'
|
|
135
|
+
c.summary = 'List archived tasks'
|
|
136
|
+
c.description = 'List all archived tasks which match the query [optional]'
|
|
137
|
+
c.action do |args, options|
|
|
138
|
+
puts Todd::Util.format_bundle list.bundle(args.shift, true)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
alias_command :arch, :archived
|
|
142
|
+
|
|
143
|
+
Todd::Base.setup
|
|
144
|
+
Todd::DB.initialize_db
|
|
145
|
+
list = Todd::DB.get_current_list
|
data/bin/todd.rb
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'commander/import'
|
|
6
|
+
require 'todd'
|
|
7
|
+
|
|
8
|
+
program :version, Todd::VERSION
|
|
9
|
+
program :description, "Todd: Time Tracking
|
|
10
|
+
Todd is a simple todo list manager which has been
|
|
11
|
+
developed with developers in mind. It allows you
|
|
12
|
+
to track how much time you spend on different tasks
|
|
13
|
+
as well as just acting as a dumb task list.
|
|
14
|
+
|
|
15
|
+
Query System:
|
|
16
|
+
Todd provides a simple query system which you can
|
|
17
|
+
use with most of its commands. The system reads
|
|
18
|
+
the following queries for selecting tasks:
|
|
19
|
+
|
|
20
|
+
n : select a single task with id = n
|
|
21
|
+
n..m : select all tasks with id > n AND id < m
|
|
22
|
+
all : select all tasks
|
|
23
|
+
last : select the last task
|
|
24
|
+
active : select all active tasks
|
|
25
|
+
inactive : select all inactive tasks
|
|
26
|
+
|
|
27
|
+
The system currently only supports a single query
|
|
28
|
+
(instead of ANDing multiple queries)
|
|
29
|
+
"
|
|
30
|
+
|
|
31
|
+
default_command :list
|
|
32
|
+
|
|
33
|
+
list = nil # todd initialized after commands
|
|
34
|
+
|
|
35
|
+
global_option('-f', '--format FORMAT', 'Set output formatting for this run') { |format|
|
|
36
|
+
Todd::Base.set_formatting format
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
command :init do |c|
|
|
40
|
+
c.syntax = 'todd init'
|
|
41
|
+
c.summary = 'Initialize Todd'
|
|
42
|
+
c.description = 'Initialize Todd in the current directory'
|
|
43
|
+
c.action do |args, options|
|
|
44
|
+
Todd::Base.init_local_dir
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
command :list do |c|
|
|
49
|
+
c.syntax = 'todd list'
|
|
50
|
+
c.summary = 'List all tasks'
|
|
51
|
+
c.description = 'List all the tasks in the current Todd List'
|
|
52
|
+
c.action do |args, options|
|
|
53
|
+
puts Todd::Util.format_bundle list.bundle
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
alias_command :ls, :list
|
|
57
|
+
|
|
58
|
+
command :find do |c|
|
|
59
|
+
c.syntax = 'todd find [query]'
|
|
60
|
+
c.summary = 'Find tasks matching query'
|
|
61
|
+
c.description = 'Find all tasks which match the query in the current Todd List'
|
|
62
|
+
c.action do |args, options|
|
|
63
|
+
puts Todd::Util.format_bundle list.bundle(args.shift)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
alias_command :f, :find
|
|
67
|
+
|
|
68
|
+
command :add do |c|
|
|
69
|
+
c.syntax = 'todd add [task]'
|
|
70
|
+
c.summary = 'Add a task'
|
|
71
|
+
c.description = 'Add a task to the current Todd List
|
|
72
|
+
[task] can contain a hash-tagged category anywhere if you want
|
|
73
|
+
to place the task in a different category than default'
|
|
74
|
+
c.example 'Add a simple task', 'todd add "Fix Todd version"'
|
|
75
|
+
c.example 'Add a task in category personal', 'todd add "Playing Videogames #personal"'
|
|
76
|
+
c.example 'Add a task in category clients', 'todd add "Working on google.com #clients"'
|
|
77
|
+
c.action do |args, options|
|
|
78
|
+
list.add args.shift
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
alias_command :a, :add
|
|
82
|
+
|
|
83
|
+
command :remove do |c|
|
|
84
|
+
c.syntax = 'todd remove [query]'
|
|
85
|
+
c.summary = 'Remove tasks'
|
|
86
|
+
c.description = 'Remove all tasks which match the query.'
|
|
87
|
+
c.action do |args, options|
|
|
88
|
+
list.rm args.shift
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
alias_command :rm, :remove
|
|
92
|
+
|
|
93
|
+
command :start do |c|
|
|
94
|
+
c.syntax = 'todd start [query]'
|
|
95
|
+
c.summary = 'Start tasks'
|
|
96
|
+
c.description = 'Start all tasks which match the query'
|
|
97
|
+
c.action do |args, options|
|
|
98
|
+
list.start args.shift
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
alias_command :s, :start
|
|
102
|
+
|
|
103
|
+
command :stop do |c|
|
|
104
|
+
c.syntax = 'todd stop [query]'
|
|
105
|
+
c.summary = 'stop tasks'
|
|
106
|
+
c.description = 'stop all tasks which match the query'
|
|
107
|
+
c.action do |args, options|
|
|
108
|
+
list.stop args.shift
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
alias_command :st, :stop
|
|
112
|
+
|
|
113
|
+
command :archive do |c|
|
|
114
|
+
c.syntax = 'todd archive [query]'
|
|
115
|
+
c.summary = 'Archive tasks'
|
|
116
|
+
c.description = 'Archive all tasks which match the query'
|
|
117
|
+
c.action do |args, options|
|
|
118
|
+
list.archive args.shift
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
alias_command :ar, :archive
|
|
122
|
+
|
|
123
|
+
command :restore do |c|
|
|
124
|
+
c.syntax = 'todd restore [query]'
|
|
125
|
+
c.summary = 'Restore tasks'
|
|
126
|
+
c.description = 'Restore all archived tasks matched by query'
|
|
127
|
+
c.action do |args, options|
|
|
128
|
+
list.restore args.shift
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
alias_command :r, :restore
|
|
132
|
+
|
|
133
|
+
command :archived do |c|
|
|
134
|
+
c.syntax = 'todd archived [query]'
|
|
135
|
+
c.summary = 'List archived tasks'
|
|
136
|
+
c.description = 'List all archived tasks which match the query [optional]'
|
|
137
|
+
c.action do |args, options|
|
|
138
|
+
puts Todd::Util.format_bundle list.bundle(args.shift, true)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
alias_command :arch, :archived
|
|
142
|
+
|
|
143
|
+
Todd::Base.setup
|
|
144
|
+
Todd::DB.initialize_db
|
|
145
|
+
list = Todd::DB.get_current_list
|