journal-cli 1.0.31 → 1.0.32
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/.rubocop.yml +2 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -17
- data/Rakefile +23 -23
- data/journal-cli.gemspec +8 -8
- data/lib/journal-cli/array.rb +2 -2
- data/lib/journal-cli/checkin.rb +111 -112
- data/lib/journal-cli/color.rb +92 -92
- data/lib/journal-cli/data.rb +1 -1
- data/lib/journal-cli/question.rb +16 -16
- data/lib/journal-cli/section.rb +6 -6
- data/lib/journal-cli/string.rb +5 -5
- data/lib/journal-cli/version.rb +1 -1
- data/lib/journal-cli/weather.rb +38 -38
- data/lib/journal-cli.rb +37 -37
- data/src/_README.md +5 -7
- metadata +3 -2
data/lib/journal-cli.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
3
|
+
require "time"
|
4
|
+
require "shellwords"
|
5
|
+
require "json"
|
6
|
+
require "yaml"
|
7
|
+
require "chronic"
|
8
|
+
require "fileutils"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require_relative
|
13
|
-
require_relative
|
14
|
-
require_relative
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
18
|
-
require_relative
|
19
|
-
require_relative
|
20
|
-
require_relative
|
10
|
+
require "tty-which"
|
11
|
+
require "tty-reader"
|
12
|
+
require_relative "journal-cli/version"
|
13
|
+
require_relative "journal-cli/color"
|
14
|
+
require_relative "journal-cli/string"
|
15
|
+
require_relative "journal-cli/data"
|
16
|
+
require_relative "journal-cli/weather"
|
17
|
+
require_relative "journal-cli/checkin"
|
18
|
+
require_relative "journal-cli/sections"
|
19
|
+
require_relative "journal-cli/section"
|
20
|
+
require_relative "journal-cli/question"
|
21
21
|
|
22
22
|
# Main Journal module
|
23
23
|
module Journal
|
@@ -26,9 +26,9 @@ module Journal
|
|
26
26
|
|
27
27
|
def notify(string, debug: false, exit_code: nil)
|
28
28
|
if debug
|
29
|
-
|
29
|
+
warn "{dw}#{string}{x}".x
|
30
30
|
else
|
31
|
-
|
31
|
+
warn "#{string}{x}".x
|
32
32
|
end
|
33
33
|
|
34
34
|
Process.exit exit_code unless exit_code.nil?
|
@@ -36,35 +36,35 @@ module Journal
|
|
36
36
|
|
37
37
|
def config
|
38
38
|
unless @config
|
39
|
-
config = File.expand_path(
|
39
|
+
config = File.expand_path("~/.config/journal/journals.yaml")
|
40
40
|
unless File.exist?(config)
|
41
41
|
default_config = {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
42
|
+
"weather_api" => "XXXXXXXXXXXXXXXXXx",
|
43
|
+
"zip" => "XXXXX",
|
44
|
+
"entries_folder" => "~/.local/share/journal/",
|
45
|
+
"journals" => {
|
46
|
+
"demo" => {
|
47
|
+
"dayone" => false,
|
48
|
+
"markdown" => "single",
|
49
|
+
"title" => "5-minute checkin",
|
50
|
+
"entries_folder" => "~/.local/share/journal/",
|
51
|
+
"sections" => [
|
52
|
+
{"title" => "Quick checkin",
|
53
|
+
"key" => "checkin",
|
54
|
+
"questions" => [
|
55
|
+
{"prompt" => "What's happening?", "key" => "journal", "type" => "multiline"}
|
56
|
+
]}
|
57
57
|
]
|
58
58
|
}
|
59
59
|
}
|
60
60
|
}
|
61
|
-
File.open(config,
|
61
|
+
File.open(config, "w") { |f| f.puts(YAML.dump(default_config)) }
|
62
62
|
puts "New configuration written to #{config}, please edit."
|
63
63
|
Process.exit 0
|
64
64
|
end
|
65
65
|
@config = YAML.load(IO.read(config))
|
66
66
|
|
67
|
-
if @config[
|
67
|
+
if @config["journals"].key?("demo")
|
68
68
|
Journal.notify("{br}Demo journal detected, please edit the configuration file at {bw}#{config}", exit_code: 1)
|
69
69
|
end
|
70
70
|
end
|
data/src/_README.md
CHANGED
@@ -38,12 +38,6 @@ If you want to use Day One with Journal, you'll need to [install the Day One CLI
|
|
38
38
|
$ sudo bash /Applications/Day\ One.app/Contents/Resources/install_cli.sh
|
39
39
|
```
|
40
40
|
|
41
|
-
## Usage
|
42
|
-
|
43
|
-
```
|
44
|
-
@cli(bundle exec bin/journal -h)
|
45
|
-
```
|
46
|
-
|
47
41
|
## Configuration
|
48
42
|
|
49
43
|
A config must be created at `~/.config/journal/journals.yaml`:
|
@@ -61,9 +55,13 @@ This file contains a YAML definition of your journal. Each journal gets a top-le
|
|
61
55
|
|
62
56
|
You can include weather data automatically by setting a question type to 'weather'. In order for this to work, you'll need to define `zip` and `weather_api` keys. `zip` is just your zip code, and `weather_api` is a key from WeatherAPI.com. Sign up [here](https://www.weatherapi.com/) for a free plan, and then visit the [profile page](https://www.weatherapi.com/my/) to see your API key at the top.
|
63
57
|
|
58
|
+
> Zip codes beginning with zero (0) must be quoted. Use:
|
59
|
+
>
|
60
|
+
> zip: '01001'
|
61
|
+
|
64
62
|
You can optionally set the key `temp_in:` to `f` or `c` to control what scale is used for temperatures.
|
65
63
|
|
66
|
-
If a question type is set to `weather.forecast`,
|
64
|
+
If a question type is set to `weather.forecast`, the moon phase and predicted condition, high, and low will be included in the JSON data for the question. A full printout of hourly temps will be included in the Markdown/Day One output.
|
67
65
|
|
68
66
|
If the question type is `weather.current`, only the current condition and temperature will be recorded to the JSON, and a string containing "[TEMP] and [CONDITION]" (e.g. "64 and Sunny") will be recorded to Markdown/Day One for the question.
|
69
67
|
|
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.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-which
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- ".github/workflows/version.yml"
|
222
222
|
- ".gitignore"
|
223
223
|
- ".rspec"
|
224
|
+
- ".rubocop.yml"
|
224
225
|
- ".ruby-version"
|
225
226
|
- CHANGELOG.md
|
226
227
|
- Gemfile
|