journal-cli 1.0.18 → 1.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ebc5eaefc846fb4343859ff0148a7798e93e2a4bcc04c5c73ce18151e59ea94
4
- data.tar.gz: 87ca031548e115350383a28da8ec853d6d665dd2a9c88ac3ea32105350120785
3
+ metadata.gz: 5120e9c5386b63b05c8d1e866614db4bc5ce4f46e5e627f6562edb22af812d5d
4
+ data.tar.gz: 69a663f28a74aa7440d0555038bad8e5273693b33a400125c49df98415c0b2df
5
5
  SHA512:
6
- metadata.gz: 7d15d09cce5d189a2d6168e02e9c3122334a88ea9e011b82fa97b0a732901913b6668407f3474211ef6b40b3b068363d9778ff4471a8ded4366089338f3fd7af
7
- data.tar.gz: 3bce2d14e6d5f078b481b9d38184e9cd005c336aeecb36bf4a5daa8b7ef66510c60d46d3cd9db97e254266c8c91a07bbf209785b3aedd2d27f6a255e256f0341
6
+ metadata.gz: 56d29c600492daeffe8186e34dc1370ac91a0bfbec0cd460986f88d293b2b4a1569d031ef78c7c7faaf3863bbb415d19ce618231969601b932a59db27b110a09
7
+ data.tar.gz: 1cb774c8c202b213d3aa08babd13ef0b07602f15f4a687150df1a101834f049c23db423cb1716d25bbf9012e7bedab4c9e80ba0934e6f131b8bda4fa9467e67a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ### 1.0.20
2
+
3
+ 2023-09-12 19:10
4
+
5
+ #### IMPROVED
6
+
7
+ - Store all numeric entries as floats, allowing decimal entries on the command line
8
+
9
+ #### FIXED
10
+
11
+ - Ensure local time for date objects
12
+
13
+ ### 1.0.19
14
+
15
+ 2023-09-11 10:52
16
+
17
+ #### IMPROVED
18
+
19
+ - Better output of date types in Markdown formats
20
+
1
21
  ### 1.0.18
2
22
 
3
23
  2023-09-09 12:29
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- journal-cli (1.0.18)
4
+ journal-cli (1.0.20)
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/na/*.rb']
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"
@@ -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,13 @@ 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
+ v.localtime
159
+ data[k] = v.strftime('%Y-%m-%d %H:%M')
153
160
  when /Weather/
154
161
  data[k] = v.to_s
155
162
  else
@@ -55,7 +55,7 @@ module Journal
55
55
  res = `gum input --placeholder "#{@prompt} (#{@min}-#{@max})"`.strip
56
56
  return nil if res.strip.empty?
57
57
 
58
- res = res.to_i
58
+ res = res.to_f
59
59
 
60
60
  res = read_number if res < @min || res > @max
61
61
  res
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Journal
4
- VERSION = '1.0.18'
4
+ VERSION = '1.0.20'
5
5
  end
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.18
4
+ version: 1.0.20
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-09 00:00:00.000000000 Z
11
+ date: 2023-09-13 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