journal-cli 1.0.13 → 1.0.14
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/lib/journal-cli/checkin.rb +26 -7
- data/lib/journal-cli/version.rb +1 -1
- data/src/_README.md +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10242acbf794f1f5e37dc3a2048c248d15c3b478e6e07ef715bb9805e7d76422
|
4
|
+
data.tar.gz: 68e6a0adce0a131e1d23d2e8ab0e513f1c4e609f18cd7e1d9ca5a8e8916c3352
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 406045f38a8ba65d1d5bbec21f49dbb6024a0934a143b9968f00884b2f7d42b812ece2cfab320adc953174f4b8960d7c480b99f4866f00761f1eab7760baae56
|
7
|
+
data.tar.gz: ab3b5d5a3bf95420048bc0109b6f5cb6926c3ec10d4dc51e5eeeea852d0cf241ea88ff3253bdb2603e8af71585d2ea89f0dec9e44e11a752eb1cf4866a078080
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
[](https://rubygems.org/gems/journal-cli)
|
3
|
+
|
2
4
|
A CLI for journaling to structured data, Markdown, and Day One
|
3
5
|
|
4
6
|
## Description
|
@@ -132,7 +134,7 @@ Once your configuration file is set up, you can just run `journal JOURNAL_KEY` t
|
|
132
134
|
|
133
135
|
If a second argument contains a natural language date, the journal entry will be set to that date instead of the current time. For example, `journal mood "yesterday 5pm"` will create a new entry (in the journal configured for `mood`) for yesterday at 5pm.
|
134
136
|
|
135
|
-
Answers will always be written to `~/.local/share/journal/[KEY]
|
137
|
+
Answers will always be written to `~/.local/share/journal/[KEY].json` (where [KEY] is the journal key, one data file for each journal). If you've specified a top-level custom path with `entries_folder` in the config, entries will be written to `[top level folder]/[KEY].json`. If you've specified a custom path using `entries_folder` within the journal, entries will be written to `[custom folder]/[KEY].json`.
|
136
138
|
|
137
139
|
If you've specified `daily` or `individual` Markdown formats, entries will be written to Markdown files in `~/.local/share/journal/[KEY]/entries`, either in a `[KEY]-%Y-%m-%d.md` file (daily), or in timestamped individual files. If `digest` is specified for the `markdown` key, a single file will be created at `~/.local/share/journal/[KEY]/entries/[KEY].md` (or a folder defined by `entries_folder`).
|
138
140
|
|
data/lib/journal-cli/checkin.rb
CHANGED
@@ -215,20 +215,39 @@ module Journal
|
|
215
215
|
journal.answers.each do |k, v|
|
216
216
|
if v.is_a? Hash
|
217
217
|
output[jk][k] = {}
|
218
|
+
|
218
219
|
v.each do |key, value|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
220
|
+
result = case value.class.to_s
|
221
|
+
when /Weather/
|
222
|
+
{ 'high' => value.data[:high], 'low' => value.data[:low], 'condition' => value.data[:condition] }
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
if jk == k
|
227
|
+
output[jk] = result
|
228
|
+
else
|
229
|
+
output[jk][k] = result
|
230
|
+
end
|
225
231
|
end
|
226
232
|
else
|
227
|
-
|
233
|
+
if jk == k
|
234
|
+
output[jk] = v
|
235
|
+
else
|
236
|
+
output[jk][k] = v
|
237
|
+
end
|
228
238
|
end
|
229
239
|
end
|
230
240
|
end
|
231
241
|
data << { 'date' => date, 'data' => output }
|
242
|
+
data.map! do |d|
|
243
|
+
{
|
244
|
+
'date' => d['date'].is_a?(String) ? Time.parse(d['date']) : d['date'],
|
245
|
+
'data' => d['data']
|
246
|
+
}
|
247
|
+
end
|
248
|
+
|
249
|
+
data.sort_by! { |e| e['date'] }
|
250
|
+
|
232
251
|
File.open(db, 'w') { |f| f.puts JSON.pretty_generate(data) }
|
233
252
|
end
|
234
253
|
end
|
data/lib/journal-cli/version.rb
CHANGED
data/src/_README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# journal
|
2
2
|
|
3
|
-
[](https://rubygems.org/gems/journal-cli)
|
4
3
|
|
5
4
|
<!--README-->
|
5
|
+
[](https://rubygems.org/gems/journal-cli)
|
6
|
+
|
6
7
|
A CLI for journaling to structured data, Markdown, and Day One
|
7
8
|
|
8
9
|
## Description
|
@@ -136,7 +137,7 @@ Once your configuration file is set up, you can just run `journal JOURNAL_KEY` t
|
|
136
137
|
|
137
138
|
If a second argument contains a natural language date, the journal entry will be set to that date instead of the current time. For example, `journal mood "yesterday 5pm"` will create a new entry (in the journal configured for `mood`) for yesterday at 5pm.
|
138
139
|
|
139
|
-
Answers will always be written to `~/.local/share/journal/[KEY]
|
140
|
+
Answers will always be written to `~/.local/share/journal/[KEY].json` (where [KEY] is the journal key, one data file for each journal). If you've specified a top-level custom path with `entries_folder` in the config, entries will be written to `[top level folder]/[KEY].json`. If you've specified a custom path using `entries_folder` within the journal, entries will be written to `[custom folder]/[KEY].json`.
|
140
141
|
|
141
142
|
If you've specified `daily` or `individual` Markdown formats, entries will be written to Markdown files in `~/.local/share/journal/[KEY]/entries`, either in a `[KEY]-%Y-%m-%d.md` file (daily), or in timestamped individual files. If `digest` is specified for the `markdown` key, a single file will be created at `~/.local/share/journal/[KEY]/entries/[KEY].md` (or a folder defined by `entries_folder`).
|
142
143
|
|