doing 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +226 -0
- data/bin/doing +149 -24
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +46 -7
- data/lib/doing.rb +5 -0
- metadata +9 -9
- data/README.rdoc +0 -49
- data/doing.rdoc +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb5416a055ea3a013f84f1e53012064b84e05ccc
|
4
|
+
data.tar.gz: 32c01753a8dad864ffc540d1695be3055bdcf665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cfcdbcbd29bbd129e8aa9928156124f76fcf6f560fd05cdb039c16c49bc47723d5d6d7007e6f6dc469f5390fc10d6f3b26995885fe52cc6a53a30c8eb920d82
|
7
|
+
data.tar.gz: e03184ca58e766fdc00f58fd247388f80d0c3e0ae7af6c4986bc0888b2ddae37930ce74ae8745e75e2404cfb3ca304b83997f03abeb58e85c85c931bdf6e7794
|
data/README.md
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
# doing
|
2
|
+
|
3
|
+
**A command line tool for remembering what you were doing and tracking what you've done.**
|
4
|
+
|
5
|
+
_If you're one of the rare people like me who find this useful, feel free to contribute to my [GitTip fund](https://www.gittip.com/ttscoff/) or just [buy me some coffee](http://brettterpstra.com/donate)._
|
6
|
+
|
7
|
+
## What and why
|
8
|
+
|
9
|
+
`doing` is a basic CLI for adding and listing "what was I doing" reminders in a [TaskPaper-formatted](http://www.hogbaysoftware.com/products/taskpaper) text file. It allows for multiple sections/categories and flexible output formatting.
|
10
|
+
|
11
|
+
While I'm working, I have hourly reminders to record what I'm working on, and I try to remember to punch in quick notes if I'm unexpectedly called away from a project. I can do this just by typing `doing now tracking down the CG bug`.
|
12
|
+
|
13
|
+
If there's something I want to look at later but doesn't need to be added to a task list or tracker, I can type `doing later check out the pinboard bookmarks from macdrifter`. When I get back to my computer --- or just need a refresher after a distraction --- I can type `doing last` to see what the last thing on my plate was. I can also type `doing recent` (or just `doing`) to get a list of the last few entries. `doing today` gives me everything since midnight for the current day, making it easy to see what I've accomplished over a sleepless night.
|
14
|
+
|
15
|
+
_Side note:_ I actually use the library behind this utility as part of another script that mirrors entries in [Day One](http://dayoneapp.com/) that have the tag "wwid." I can use the hourly writing reminders and enter my stuff in the quick entry popup. Someday I'll get around to cleaning that up and putting it out there.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
[sudo] gem install doing
|
20
|
+
|
21
|
+
## The "doing" file
|
22
|
+
|
23
|
+
The file that stores all of your entries is generated the first time you add an entry with `doing now` (or `doing later`). By default the file is created in "~/what_was_i_doing.md", but this can be modified in the config file.
|
24
|
+
|
25
|
+
The format of the "doing" file is TaskPaper-compatible. You can edit it by hand at any time (in TaskPaper or any text editor), but it uses a specific format for parsing, so be sure to maintain the dates and pipe characters.
|
26
|
+
|
27
|
+
Notes are anything in the list without a leading hyphen and date. They belong to the entry directly before them, and they should be indented one level beyond the parent item. The `now` and `later` commands don't currently make it possible to add notes at the time of entry creation, but I have scripts that do it and will incorporate them soon.
|
28
|
+
|
29
|
+
## Configuration
|
30
|
+
|
31
|
+
A basic configuration looks like this:
|
32
|
+
|
33
|
+
---
|
34
|
+
doing_file: /Users/username/Dropbox/nvALT2.2/?? What was I doing.md
|
35
|
+
current_section: Currently
|
36
|
+
default_template: '%date: %title%note'
|
37
|
+
default_date_format: '%Y-%m-%d %H:%M'
|
38
|
+
templates:
|
39
|
+
default:
|
40
|
+
date_format: '%Y-%m-%d %H:%M'
|
41
|
+
template: '%date | %title%note'
|
42
|
+
wrap_width: 0
|
43
|
+
today:
|
44
|
+
date_format: '%_I:%M%P'
|
45
|
+
template: '%date: %title%odnote'
|
46
|
+
wrap_width: 0
|
47
|
+
last:
|
48
|
+
date_format: '%_I:%M%P on %a'
|
49
|
+
template: '%title (at %date)%odnote'
|
50
|
+
wrap_width: 0
|
51
|
+
recent:
|
52
|
+
date_format: '%_I:%M%P'
|
53
|
+
template: '%date > %title%odnote'
|
54
|
+
wrap_width: 50
|
55
|
+
:include_notes: true
|
56
|
+
|
57
|
+
|
58
|
+
The config file is stored in "~/.doingrc", and is created on the first run.
|
59
|
+
|
60
|
+
The one thing you'll probably want to adjust is the file that the notes are stored in. That's the `doing_file` key:
|
61
|
+
|
62
|
+
doing_file: /Users/username/Dropbox/nvALT2.2/?? What was I doing.md
|
63
|
+
|
64
|
+
I keep mine in my nvALT folder for quick access and syncing between machines. If desired, you can give it a `.taskpaper` extension to make it more recognizable to other applications. (If you do that in nvALT, make sure to add `taskpaper` as a recognized extension in preferences).
|
65
|
+
|
66
|
+
You can rename the section that holds your current tasks. By default, this is "Currently," but if you have some other bright idea, feel free:
|
67
|
+
|
68
|
+
current_section: Currently
|
69
|
+
|
70
|
+
The config also contains templates for various command outputs. Include placeholders by placing a % before the keyword. The available tokens are:
|
71
|
+
|
72
|
+
- `%title`: the "what was I doing" entry line
|
73
|
+
- `%date`: the date based on the template's "date_format" setting
|
74
|
+
- `%shortdate`: a custom date formatter that removes the day/month/year from the entry if they match the current day/month/year
|
75
|
+
- `%note`: Any note in the entry will be included here, a newline and tabs are automatically added.
|
76
|
+
- `%odnote`: The notes with a leading tab removed (outdented note)
|
77
|
+
- `%hr`: a horizontal rule (`-`) the width of the terminal
|
78
|
+
- `%hr_under`: a horizontal rule (`_`) the width of the terminal
|
79
|
+
- `%[color]`: color can be black, red, green, blue, yellow, magenta, cyan or white
|
80
|
+
- you can prefix "bg" to affect background colors (%bgyellow)
|
81
|
+
- prefix "bold" and "boldbg" for strong colors (%boldgreen, %boldbgblue)
|
82
|
+
|
83
|
+
Date formats are based on Ruby [strftime](http://www.ruby-doc.org/stdlib-2.1.1/libdoc/date/rdoc/Date.html#method-i-strftime) formatting.
|
84
|
+
|
85
|
+
My normal template for the `recent` command looks like this:
|
86
|
+
|
87
|
+
recent:
|
88
|
+
date_format: '%_I:%M%P'
|
89
|
+
template: '%date > %title%odnote'
|
90
|
+
wrap_width: 88
|
91
|
+
|
92
|
+
And it outputs:
|
93
|
+
|
94
|
+
$ doing recent 3
|
95
|
+
4:30am > Made my `console` script smarter...
|
96
|
+
Checks first argument to see if it's a file, if it is, that's the log
|
97
|
+
|
98
|
+
Else, it checks the first argument for a ".log" suffix and does a search in the user
|
99
|
+
application logs with `find` for it.
|
100
|
+
|
101
|
+
Otherwise, system.log.
|
102
|
+
|
103
|
+
I also made an awesome Cope wrapper for it...
|
104
|
+
12:00pm > Working on `doing` again.
|
105
|
+
12:45pm > I think this thing (doing) is ready to document and distribute
|
106
|
+
$
|
107
|
+
|
108
|
+
You can get pretty clever and include line breaks and other formatting inside of double quotes. If you want multiline templates, just use "\n" in the template line and after the next run it will be rewritten as proper YAML automatically.
|
109
|
+
|
110
|
+
For example, this block:
|
111
|
+
|
112
|
+
recent:
|
113
|
+
date_format: '%_I:%M%P'
|
114
|
+
template: "\n%hr\n%date\n > %title%odnote\n%hr_under"
|
115
|
+
wrap_width: 100
|
116
|
+
|
117
|
+
will rewrite to:
|
118
|
+
|
119
|
+
recent:
|
120
|
+
date_format: '%_I:%M%P'
|
121
|
+
template: |2-
|
122
|
+
|
123
|
+
%hr
|
124
|
+
%date
|
125
|
+
> %title%odnote
|
126
|
+
%hr_under
|
127
|
+
wrap_width: 100
|
128
|
+
|
129
|
+
and output my recent entries like this:
|
130
|
+
|
131
|
+
$ doing recent 3
|
132
|
+
-----------------------------------------------------------------------
|
133
|
+
4:30am
|
134
|
+
> Made my `console` script smarter...
|
135
|
+
Checks first argument to see if it's a file, if it is, that's the log
|
136
|
+
|
137
|
+
Else, it checks the first argument for a ".log" suffix and does a search in the user application
|
138
|
+
logs with `find` for it.
|
139
|
+
|
140
|
+
Otherwise, system.log.
|
141
|
+
|
142
|
+
I also made an awesome Cope wrapper for it...
|
143
|
+
_______________________________________________________________________
|
144
|
+
|
145
|
+
-----------------------------------------------------------------------
|
146
|
+
12:00pm
|
147
|
+
> Working on `doing` again.
|
148
|
+
_______________________________________________________________________
|
149
|
+
|
150
|
+
-----------------------------------------------------------------------
|
151
|
+
12:45pm
|
152
|
+
> I think this thing (doing) is ready to document and distribute
|
153
|
+
_______________________________________________________________________
|
154
|
+
|
155
|
+
$
|
156
|
+
|
157
|
+
### Custom views
|
158
|
+
|
159
|
+
You can create your own "views" in the `~/.doingrc` file and view them with `doing view view_name`. Just add a section like this:
|
160
|
+
|
161
|
+
views:
|
162
|
+
old:
|
163
|
+
section: Old
|
164
|
+
count: 5
|
165
|
+
wrap_width: 0
|
166
|
+
date_format: '%F %_I:%M%P'
|
167
|
+
template: '%date | %title%note'
|
168
|
+
|
169
|
+
You can add additional custom views, just nest them under the "views" key (indented two spaces from the edge). Multiple views would look like this:
|
170
|
+
|
171
|
+
views:
|
172
|
+
mine:
|
173
|
+
section: Later
|
174
|
+
count: 5
|
175
|
+
wrap_width: 60
|
176
|
+
date_format: '%F %_I:%M%P'
|
177
|
+
template: '%date | %title%note'
|
178
|
+
old:
|
179
|
+
section: Old
|
180
|
+
count: 5
|
181
|
+
wrap_width: 0
|
182
|
+
date_format: '%F %_I:%M%P'
|
183
|
+
template: '%date | %title%note'
|
184
|
+
|
185
|
+
The "section" key is the default section to pull entries from. Count and section can be overridden at runtime with the `-c` and `-s` flags.
|
186
|
+
|
187
|
+
You can add new sections with `done add_section section_name`. You can also create them on the fly by using the `-s section_name` flag when running `doing now`. For example, `doing now -s Misc just a random side note` would create the "just a random side note" entry in a new section called "Misc."
|
188
|
+
|
189
|
+
## Usage:
|
190
|
+
|
191
|
+
doing [global options] command [command options] [arguments...]
|
192
|
+
|
193
|
+
### Global options:
|
194
|
+
|
195
|
+
--[no-]notes - Output notes if included in the template (default: enabled)
|
196
|
+
--version - Display the program version
|
197
|
+
--help - Show help message and usage summary
|
198
|
+
|
199
|
+
### Commands:
|
200
|
+
|
201
|
+
help - Shows a list of commands or help for one command (`doing help now`)
|
202
|
+
|
203
|
+
#### Adding entries:
|
204
|
+
|
205
|
+
now - Add an entry
|
206
|
+
later - Add an item to the Later section
|
207
|
+
done - Add an entry tagged with @done(YYYY-mm-dd hh:mm)
|
208
|
+
|
209
|
+
#### Displaying entries:
|
210
|
+
|
211
|
+
show - List all entries
|
212
|
+
recent - List recent entries
|
213
|
+
today - List entries from today
|
214
|
+
last - Show the last entry
|
215
|
+
|
216
|
+
#### Sections
|
217
|
+
|
218
|
+
sections - List sections
|
219
|
+
choose - Select a section to display from a menu
|
220
|
+
|
221
|
+
#### Utilities
|
222
|
+
|
223
|
+
archive - Move all but the most recent 5 entries to the Archive section
|
224
|
+
config - Edit the default configuration
|
225
|
+
|
226
|
+
|
data/bin/doing
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'gli'
|
3
3
|
require 'doing'
|
4
|
+
require 'tempfile'
|
4
5
|
|
5
6
|
include GLI::App
|
7
|
+
version Doing::VERSION
|
6
8
|
|
7
9
|
wwid = WWID.new
|
8
10
|
|
9
11
|
program_desc 'A CLI for a What Was I Doing system'
|
10
12
|
|
11
|
-
version Doing::VERSION
|
12
|
-
|
13
13
|
default_command :recent
|
14
14
|
sort_help :manually
|
15
15
|
|
@@ -24,15 +24,42 @@ desc 'Add an entry'
|
|
24
24
|
arg_name 'entry'
|
25
25
|
command :now do |c|
|
26
26
|
c.desc 'Section'
|
27
|
+
c.arg_name 'section_name'
|
27
28
|
c.default_value wwid.current_section
|
28
29
|
c.flag [:s,:section]
|
29
30
|
|
31
|
+
c.desc "Edit entry with #{ENV['EDITOR']}"
|
32
|
+
c.switch [:e,:editor]
|
33
|
+
|
34
|
+
# c.desc "Edit entry with specified app"
|
35
|
+
# c.arg_name 'editor_app'
|
36
|
+
# c.default_value wwid.config.has_key?('editor_app') && wwid.config['editor_app'] ? wwid.config['editor_app'] : false
|
37
|
+
# c.flag [:a,:app]
|
38
|
+
|
30
39
|
c.action do |global_options,options,args|
|
31
|
-
if args.length
|
32
|
-
|
33
|
-
|
40
|
+
if options[:e] || (args.length == 0 && STDIN.stat.size == 0)
|
41
|
+
input = ""
|
42
|
+
input += args.join(" ") if args.length > 0
|
43
|
+
input = wwid.fork_editor(input)
|
44
|
+
if input
|
45
|
+
title, note = wwid.format_input(input)
|
46
|
+
wwid.add_item(title.cap_first, options[:s].cap_first, {:note => note})
|
47
|
+
wwid.write(wwid.doing_file)
|
48
|
+
else
|
49
|
+
raise "No content"
|
50
|
+
end
|
34
51
|
else
|
35
|
-
|
52
|
+
if args.length > 0
|
53
|
+
title, note = wwid.format_input(args.join(" "))
|
54
|
+
wwid.add_item(title.cap_first, options[:s].cap_first, {:note => note})
|
55
|
+
wwid.write(wwid.doing_file)
|
56
|
+
elsif STDIN.stat.size > 0
|
57
|
+
title, note = wwid.format_input(STDIN.read)
|
58
|
+
wwid.add_item(title.cap_first, options[:s].cap_first, {:note => note})
|
59
|
+
wwid.write(wwid.doing_file)
|
60
|
+
else
|
61
|
+
raise "You must provide content when creating a new entry"
|
62
|
+
end
|
36
63
|
end
|
37
64
|
end
|
38
65
|
end
|
@@ -40,12 +67,38 @@ end
|
|
40
67
|
desc 'Add an item to the Later section'
|
41
68
|
arg_name 'entry'
|
42
69
|
command :later do |c|
|
70
|
+
c.desc "Edit entry with #{ENV['EDITOR']}"
|
71
|
+
c.switch [:e,:editor]
|
72
|
+
|
73
|
+
c.desc "Edit entry with specified app"
|
74
|
+
c.arg_name 'editor_app'
|
75
|
+
c.default_value wwid.config.has_key?('editor_app') && wwid.config['editor_app'] ? wwid.config['editor_app'] : false
|
76
|
+
c.flag [:a,:app]
|
77
|
+
|
43
78
|
c.action do |global_options,options,args|
|
44
|
-
if args.length
|
45
|
-
|
46
|
-
|
79
|
+
if options[:e] || (args.length == 0 && STDIN.stat.size == 0)
|
80
|
+
input = ""
|
81
|
+
input += args.join(" ") if args.length > 0
|
82
|
+
input = wwid.fork_editor(input)
|
83
|
+
if input
|
84
|
+
title, note = wwid.format_input(input)
|
85
|
+
wwid.add_item(title.cap_first, "Later", {:note => note})
|
86
|
+
wwid.write(wwid.doing_file)
|
87
|
+
else
|
88
|
+
raise "No content"
|
89
|
+
end
|
47
90
|
else
|
48
|
-
|
91
|
+
if args.length > 0
|
92
|
+
title, note = wwid.format_input(args.join(" "))
|
93
|
+
wwid.add_item(title.cap_first, "Later", {:note => note})
|
94
|
+
wwid.write(wwid.doing_file)
|
95
|
+
elsif STDIN.stat.size > 0
|
96
|
+
title, note = wwid.format_input(STDIN.read)
|
97
|
+
wwid.add_item(title.cap_first, "Later", {:note => note})
|
98
|
+
wwid.write(wwid.doing_file)
|
99
|
+
else
|
100
|
+
raise "You must provide content when creating a new entry"
|
101
|
+
end
|
49
102
|
end
|
50
103
|
end
|
51
104
|
end
|
@@ -60,15 +113,44 @@ command :done do |c|
|
|
60
113
|
c.default_value wwid.current_section
|
61
114
|
c.flag [:s,:section], :default_value => wwid.current_section
|
62
115
|
|
116
|
+
c.desc "Edit entry with #{ENV['EDITOR']}"
|
117
|
+
c.switch [:e,:editor]
|
118
|
+
|
119
|
+
# c.desc "Edit entry with specified app"
|
120
|
+
# c.arg_name 'editor_app'
|
121
|
+
# c.default_value wwid.config.has_key?('editor_app') && wwid.config['editor_app'] ? wwid.config['editor_app'] : false
|
122
|
+
# c.flag [:a,:app]
|
123
|
+
|
63
124
|
c.action do |global_options,options,args|
|
64
|
-
if args.length
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
125
|
+
if options[:e] || (args.length == 0 && STDIN.stat.size == 0)
|
126
|
+
input = ""
|
127
|
+
input += args.join(" ") if args.length > 0
|
128
|
+
input = wwid.fork_editor(input)
|
129
|
+
if input
|
130
|
+
title, note = wwid.format_input(input)
|
131
|
+
title += " @done(#{Time.now.strftime('%F %R')})"
|
132
|
+
section = options[:a] ? "Archive" : options[:s]
|
133
|
+
wwid.add_item(title.cap_first, section.cap_first, {:note => note})
|
134
|
+
wwid.write(wwid.doing_file)
|
135
|
+
else
|
136
|
+
raise "No content"
|
137
|
+
end
|
70
138
|
else
|
71
|
-
|
139
|
+
if args.length > 0
|
140
|
+
title, note = wwid.format_input(args.join(" "))
|
141
|
+
title += " @done(#{Time.now.strftime('%F %R')})"
|
142
|
+
section = options[:a] ? "Archive" : options[:s]
|
143
|
+
wwid.add_item(title.cap_first, section.cap_first, {:note => note})
|
144
|
+
wwid.write(wwid.doing_file)
|
145
|
+
elsif STDIN.stat.size > 0
|
146
|
+
title, note = wwid.format_input(STDIN.read)
|
147
|
+
title += " @done(#{Time.now.strftime('%F %R')})"
|
148
|
+
section = options[:a] ? "Archive" : options[:s]
|
149
|
+
wwid.add_item(title.cap_first, section.cap_first, {:note => note})
|
150
|
+
wwid.write(wwid.doing_file)
|
151
|
+
else
|
152
|
+
raise "You must provide content when creating a new entry"
|
153
|
+
end
|
72
154
|
end
|
73
155
|
end
|
74
156
|
end
|
@@ -98,12 +180,14 @@ command :recent do |c|
|
|
98
180
|
c.default_value wwid.current_section
|
99
181
|
c.flag [:s,:section]
|
100
182
|
c.action do |global_options,options,args|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
183
|
+
unless global_options[:version]
|
184
|
+
if args.length > 0
|
185
|
+
count = args[0].to_i
|
186
|
+
else
|
187
|
+
count = 10
|
188
|
+
end
|
189
|
+
puts wwid.recent(count,options[:s].cap_first)
|
105
190
|
end
|
106
|
-
puts wwid.recent(count,options[:s].cap_first)
|
107
191
|
end
|
108
192
|
end
|
109
193
|
|
@@ -182,7 +266,7 @@ command :archive do |c|
|
|
182
266
|
|
183
267
|
c.action do |global_options,options,args|
|
184
268
|
if args.length > 0
|
185
|
-
section = args.join(" ").
|
269
|
+
section = args.join(" ").cap_first
|
186
270
|
else
|
187
271
|
section = wwid.current_section
|
188
272
|
end
|
@@ -190,6 +274,45 @@ command :archive do |c|
|
|
190
274
|
end
|
191
275
|
end
|
192
276
|
|
277
|
+
desc 'Open the "doing" file in an editor (OS X)'
|
278
|
+
command :open do |c|
|
279
|
+
c.desc 'open with app name'
|
280
|
+
c.arg_name 'app_name'
|
281
|
+
c.flag [:a]
|
282
|
+
|
283
|
+
c.desc 'open with app bundle id'
|
284
|
+
c.arg_name 'bundle_id'
|
285
|
+
c.flag [:b]
|
286
|
+
|
287
|
+
c.desc 'open with $EDITOR'
|
288
|
+
c.switch [:e], :negatable => false
|
289
|
+
|
290
|
+
c.action do |global_options,options,args|
|
291
|
+
params = options.dup
|
292
|
+
params.delete_if { |k,v|
|
293
|
+
k.class == String || v.nil? || v == false
|
294
|
+
}
|
295
|
+
|
296
|
+
if params.length < 2
|
297
|
+
if options[:a]
|
298
|
+
system %Q{open -a "#{options[:a]}" "#{File.expand_path(wwid.doing_file)}"}
|
299
|
+
elsif options[:b]
|
300
|
+
system %Q{open -b "#{options[:b]}" "#{File.expand_path(wwid.doing_file)}"}
|
301
|
+
elsif options[:e]
|
302
|
+
system %Q{$EDITOR "#{File.expand_path(wwid.doing_file)}"}
|
303
|
+
else
|
304
|
+
if wwid.config.has_key?('editor_app') && !wwid.config['editor_app'].nil?
|
305
|
+
system %Q{open -a "#{wwid.config['editor_app']}" "#{File.expand_path(wwid.doing_file)}"}
|
306
|
+
else
|
307
|
+
system %Q{open "#{File.expand_path(wwid.doing_file)}"}
|
308
|
+
end
|
309
|
+
end
|
310
|
+
else
|
311
|
+
raise "The open command takes a single parameter. #{params.length} specified."
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
193
316
|
desc 'Edit the configuration file'
|
194
317
|
command :config do |c|
|
195
318
|
c.desc 'Editor to use'
|
@@ -203,7 +326,9 @@ end
|
|
203
326
|
|
204
327
|
pre do |global,command,options,args|
|
205
328
|
wwid.config[:include_notes] = false unless global[:notes]
|
206
|
-
|
329
|
+
if global[:version]
|
330
|
+
puts "doing v" + Doing::VERSION
|
331
|
+
end
|
207
332
|
# Return true to proceed; false to abort and not call the
|
208
333
|
# chosen command
|
209
334
|
# Use skips_pre before a command to skip this block
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid.rb
CHANGED
@@ -1,9 +1,4 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
require 'time'
|
3
|
-
require 'date'
|
4
|
-
require 'yaml'
|
5
|
-
require 'pp'
|
6
|
-
|
7
2
|
class String
|
8
3
|
def cap_first
|
9
4
|
self.sub(/^\w/) do |m|
|
@@ -23,7 +18,7 @@ class WWID
|
|
23
18
|
|
24
19
|
@config['doing_file'] ||= "~/what_was_i_doing.md"
|
25
20
|
@config['current_section'] ||= 'Currently'
|
26
|
-
|
21
|
+
@config['editor_app'] ||= nil
|
27
22
|
@config['templates'] ||= {}
|
28
23
|
@config['templates']['default'] ||= {
|
29
24
|
'date_format' => '%Y-%m-%d %H:%M',
|
@@ -139,6 +134,50 @@ class WWID
|
|
139
134
|
end
|
140
135
|
end
|
141
136
|
|
137
|
+
def fork_editor(input="")
|
138
|
+
tmpfile = Tempfile.new('doing')
|
139
|
+
|
140
|
+
File.open(tmpfile.path,'w+') do |f|
|
141
|
+
f.puts input
|
142
|
+
end
|
143
|
+
|
144
|
+
pid = Process.fork { system(ENV['EDITOR'], "#{tmpfile.path}") }
|
145
|
+
|
146
|
+
trap("INT") {
|
147
|
+
Process.kill(9, pid) rescue Errno::ESRCH
|
148
|
+
tmpfile.unlink
|
149
|
+
tmpfile.close!
|
150
|
+
exit 0
|
151
|
+
}
|
152
|
+
|
153
|
+
Process.wait(pid)
|
154
|
+
|
155
|
+
begin
|
156
|
+
input = IO.read(tmpfile.path)
|
157
|
+
ensure
|
158
|
+
tmpfile.close
|
159
|
+
tmpfile.unlink
|
160
|
+
end
|
161
|
+
|
162
|
+
input
|
163
|
+
end
|
164
|
+
|
165
|
+
# This takes a multi-line string and formats it as an entry
|
166
|
+
# returns an array of [title(String), note(Array)]
|
167
|
+
def format_input(input)
|
168
|
+
return false unless input && input.length > 0
|
169
|
+
input_lines = input.strip.split(/[\n\r]+/)
|
170
|
+
title = input_lines[0].strip
|
171
|
+
note = input_lines.length > 1 ? input_lines[1..-1] : []
|
172
|
+
note.map! { |line|
|
173
|
+
line.strip
|
174
|
+
}.delete_if { |line|
|
175
|
+
line =~ /^\s*$/
|
176
|
+
}
|
177
|
+
|
178
|
+
[title, note]
|
179
|
+
end
|
180
|
+
|
142
181
|
def sections
|
143
182
|
@content.keys
|
144
183
|
end
|
@@ -151,7 +190,7 @@ class WWID
|
|
151
190
|
section ||= @current_section
|
152
191
|
add_section(section) unless @content.has_key?(section)
|
153
192
|
opt[:date] ||= Time.now
|
154
|
-
opt[:note] ||=
|
193
|
+
opt[:note] ||= []
|
155
194
|
|
156
195
|
entry = {'title' => title.strip.cap_first, 'date' => opt[:date]}
|
157
196
|
unless opt[:note] =~ /^\s*$/s
|
data/lib/doing.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - '='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 2.
|
67
|
+
version: 2.9.0
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 2.
|
74
|
+
version: 2.9.0
|
75
75
|
description: A tool for managing a TaskPaper-like file of recent activites. Perfect
|
76
76
|
for the late-night hacker on too much caffeine to remember what they accomplished
|
77
77
|
at 2 in the morning.
|
@@ -80,12 +80,10 @@ executables:
|
|
80
80
|
- doing
|
81
81
|
extensions: []
|
82
82
|
extra_rdoc_files:
|
83
|
-
- README.
|
84
|
-
- doing.rdoc
|
83
|
+
- README.md
|
85
84
|
files:
|
86
|
-
- README.
|
85
|
+
- README.md
|
87
86
|
- bin/doing
|
88
|
-
- doing.rdoc
|
89
87
|
- lib/doing.rb
|
90
88
|
- lib/doing/version.rb
|
91
89
|
- lib/doing/wwid.rb
|
@@ -98,7 +96,9 @@ rdoc_options:
|
|
98
96
|
- --title
|
99
97
|
- doing
|
100
98
|
- --main
|
101
|
-
- README.
|
99
|
+
- README.md
|
100
|
+
- --markup
|
101
|
+
- markdown
|
102
102
|
- -ri
|
103
103
|
require_paths:
|
104
104
|
- lib
|
data/README.rdoc
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
= doing
|
2
|
-
|
3
|
-
A basic CLI for adding and listing "what was I doing" reminders in a text file. Allows for multiple sections and flexible output formatting.
|
4
|
-
|
5
|
-
The format of the "WWID" file is TaskPaper-compatible. You can edit it by hand at any time, but it uses a specific format for parsing, so be careful. By default the file is created in "~/what_was_i_doing.md", but this can be modified in the config file.
|
6
|
-
|
7
|
-
The config file is stored in "~/.doingrc", and is created on the first run. It contains, among other things, templates for various command outputs. Include placeholders by placing a % before the keyword. The available placeholders are:
|
8
|
-
|
9
|
-
- %title: the "wwid" entry line
|
10
|
-
- %date: the date based on the templates "date_format" setting
|
11
|
-
- %shortdate: a custom date formatter that removes the day/month/year from the entry if they match the current day/month/year
|
12
|
-
- %note: Any note in the entry will be included here, a newline and tabs are automatically added.
|
13
|
-
- %odnote: The notes with a leading tab removed (outdented note)
|
14
|
-
- %hr: a horizontal rule (`-`) the width of the terminal
|
15
|
-
- %hr_under: a horizontal rule (`_`) the width of the terminal
|
16
|
-
- `%[color]`: color can be black, green, blue, yellow, magenta, cyan or white
|
17
|
-
- you can prefix "bg" to affect background colors (%bgyellow)
|
18
|
-
- prefix "bold" and "boldbg" for strong colors (%boldgreen, %boldbgblue)
|
19
|
-
|
20
|
-
|
21
|
-
Date formats are based on Ruby `strftime` formatting.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
Usage:
|
26
|
-
|
27
|
-
doing [global options] command [command options] [arguments...]
|
28
|
-
|
29
|
-
Global options:
|
30
|
-
|
31
|
-
--help - Show this message
|
32
|
-
--[no-]notes - Output notes if included in the template (default: enabled)
|
33
|
-
--version - Display the program version
|
34
|
-
|
35
|
-
Commands:
|
36
|
-
|
37
|
-
archive - Archive all but the most recent 5 entries
|
38
|
-
choose - Select a section to display
|
39
|
-
config - Edit the default configuration
|
40
|
-
done - Add an entry tagged with @done(YYYY-mm-dd hh:mm)
|
41
|
-
help - Shows a list of commands or help for one command
|
42
|
-
last - Show the last entry
|
43
|
-
later - Add an item to the Later section
|
44
|
-
now - Add an entry
|
45
|
-
recent - List recent entries
|
46
|
-
sections - List sections
|
47
|
-
show - List all entries
|
48
|
-
today - List entries from today
|
49
|
-
|
data/doing.rdoc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
= doing
|