journal-cli 1.0.18 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +3 -1
- data/README.md +10 -0
- data/Rakefile +1 -1
- data/journal-cli.gemspec +1 -0
- data/lib/journal-cli/checkin.rb +6 -0
- data/lib/journal-cli/version.rb +1 -1
- data/src/_README.md +10 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac1922ce0228559564036c16e95a4d3042ff0dd36a5eb1137286ec7377b0919b
|
4
|
+
data.tar.gz: 57a0801095a4f5809607819d8eaded1840b4ba5db9ebc41a9090abde76995644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2811f0647206c869d8c7708f90fcdcc0833c3de261d6024bc5ec5a164d2117b25de7d570e4676103e88387ff407fa3a4d8744b6cef6f63c220ad942c1d1c7ad
|
7
|
+
data.tar.gz: d281c93a7d23e567ad0c36d41cd417cd030011f5687f1ffcfcef07f54d01501863cdbf19ad64b2215a25ab9265b4e073cb0c26f9683d4c97868def1577c62e1c
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
journal-cli (1.0.
|
4
|
+
journal-cli (1.0.19)
|
5
5
|
chronic (~> 0.10, >= 0.10.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -75,6 +75,7 @@ GEM
|
|
75
75
|
unicode-display_width (>= 1.1.1, < 3)
|
76
76
|
thor (1.2.1)
|
77
77
|
unicode-display_width (2.3.0)
|
78
|
+
yard (0.9.34)
|
78
79
|
|
79
80
|
PLATFORMS
|
80
81
|
arm64-darwin-21
|
@@ -94,6 +95,7 @@ DEPENDENCIES
|
|
94
95
|
simplecov (~> 0.21)
|
95
96
|
simplecov-console (~> 0.9)
|
96
97
|
standard (~> 1.3)
|
98
|
+
yard (~> 0.9, >= 0.9.26)
|
97
99
|
|
98
100
|
BUNDLED WITH
|
99
101
|
2.4.1
|
data/README.md
CHANGED
@@ -130,6 +130,16 @@ A journal must contain a `sections` key, and each section must contain a `questi
|
|
130
130
|
|
131
131
|
If a question has a key `secondary_question`, the prompt will be repeated with the secondary question until it's returned empty, answers will be joined together.
|
132
132
|
|
133
|
+
### Question Types
|
134
|
+
|
135
|
+
A question `type` can be one of:
|
136
|
+
|
137
|
+
- `text` or `string` will request a single-line string, submitted on return
|
138
|
+
- `multiline` for multiline strings (opens a readline editor, use ctrl-d to save)
|
139
|
+
- `weather` will just insert current weather data with no prompt
|
140
|
+
- `integer` or `number` will request numeric input
|
141
|
+
- `date` will request a natural language date which will be parsed into a date object
|
142
|
+
|
133
143
|
### Naming Keys
|
134
144
|
|
135
145
|
If you want data stored in a nested object, you can set a question type to `dictionary` and set the prompt to `null` (or just leave the key out), but give it a key that will serve as the parent in the object. Then in the nested questions, give them a key in the dot format `[PARENT_KEY].[CHILD_KEY]`. Section keys automatically nest their children, but if you want to go deeper, you could have a question with the key `health` and type `dictionary`, then have questions with keys like `health.rating` and `health.notes`. If the section key was `status`, the resulting dictionary would look like this in the JSON:
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ Rake::RDocTask.new do |rd|
|
|
11
11
|
end
|
12
12
|
|
13
13
|
YARD::Rake::YardocTask.new do |t|
|
14
|
-
t.files = ['lib/
|
14
|
+
t.files = ['lib/journal-cli/*.rb']
|
15
15
|
t.options = ['--markup-provider=redcarpet', '--markup=markdown', '--no-private', '-p', 'yard_templates']
|
16
16
|
# t.stats_options = ['--list-undoc']
|
17
17
|
end
|
data/journal-cli.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "gem-release", "~> 2.2"
|
32
32
|
spec.add_development_dependency "parse_gemspec-cli", "~> 1.0"
|
33
33
|
spec.add_development_dependency "rake", "~> 13.0"
|
34
|
+
spec.add_development_dependency('yard', '~> 0.9', '>= 0.9.26')
|
34
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
35
36
|
spec.add_development_dependency "simplecov", "~> 0.21"
|
36
37
|
spec.add_development_dependency "simplecov-console", "~> 0.9"
|
data/lib/journal-cli/checkin.rb
CHANGED
@@ -135,6 +135,8 @@ module Journal
|
|
135
135
|
hr
|
136
136
|
when /^(int|num)/
|
137
137
|
@output << "#{prompt}: #{data[key]} " unless data[key].nil?
|
138
|
+
when /^date/
|
139
|
+
@output << "#{prompt}: #{data[key].strftime('%Y-%m-%d %H:%M')}" unless data[key].nil?
|
138
140
|
else
|
139
141
|
unless data[key].strip.empty?
|
140
142
|
header prompt
|
@@ -148,8 +150,12 @@ module Journal
|
|
148
150
|
data = {}
|
149
151
|
answers.each do |k, v|
|
150
152
|
case v.class.to_s
|
153
|
+
when /String/
|
154
|
+
next
|
151
155
|
when /Hash/
|
152
156
|
data[k] = weather_to_yaml(v)
|
157
|
+
when /Date/
|
158
|
+
data[k] = v.strftime('%Y-%m-%d %H:%M')
|
153
159
|
when /Weather/
|
154
160
|
data[k] = v.to_s
|
155
161
|
else
|
data/lib/journal-cli/version.rb
CHANGED
data/src/_README.md
CHANGED
@@ -133,6 +133,16 @@ A journal must contain a `sections` key, and each section must contain a `questi
|
|
133
133
|
|
134
134
|
If a question has a key `secondary_question`, the prompt will be repeated with the secondary question until it's returned empty, answers will be joined together.
|
135
135
|
|
136
|
+
### Question Types
|
137
|
+
|
138
|
+
A question `type` can be one of:
|
139
|
+
|
140
|
+
- `text` or `string` will request a single-line string, submitted on return
|
141
|
+
- `multiline` for multiline strings (opens a readline editor, use ctrl-d to save)
|
142
|
+
- `weather` will just insert current weather data with no prompt
|
143
|
+
- `integer` or `number` will request numeric input
|
144
|
+
- `date` will request a natural language date which will be parsed into a date object
|
145
|
+
|
136
146
|
### Naming Keys
|
137
147
|
|
138
148
|
If you want data stored in a nested object, you can set a question type to `dictionary` and set the prompt to `null` (or just leave the key out), but give it a key that will serve as the parent in the object. Then in the nested questions, give them a key in the dot format `[PARENT_KEY].[CHILD_KEY]`. Section keys automatically nest their children, but if you want to go deeper, you could have a question with the key `health` and type `dictionary`, then have questions with keys like `health.rating` and `health.notes`. If the section key was `status`, the resulting dictionary would look like this in the JSON:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: journal-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,26 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '13.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.9'
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 0.9.26
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0.9'
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.9.26
|
69
89
|
- !ruby/object:Gem::Dependency
|
70
90
|
name: rspec
|
71
91
|
requirement: !ruby/object:Gem::Requirement
|