journal-cli 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.devcontainer/Dockerfile +11 -0
- data/.devcontainer/devcontainer.json +17 -0
- data/.editorconfig +9 -0
- data/.github/actions/setup/action.yml +34 -0
- data/.github/workflows/_build.yml +36 -0
- data/.github/workflows/_publish.yml +47 -0
- data/.github/workflows/check.yml +112 -0
- data/.github/workflows/format.yml +41 -0
- data/.github/workflows/publish.yml +56 -0
- data/.github/workflows/version.yml +52 -0
- data/.gitignore +67 -0
- data/.rspec +4 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +99 -0
- data/LICENSE.txt +20 -0
- data/README.md +127 -0
- data/README.rdoc +6 -0
- data/Rakefile +85 -0
- data/bin/journal +32 -0
- data/lib/journal-cli/checkin.rb +262 -0
- data/lib/journal-cli/data.rb +21 -0
- data/lib/journal-cli/version.rb +5 -0
- data/lib/journal-cli/weather.rb +103 -0
- data/lib/journal-cli.rb +13 -0
- data/src/_README.md +161 -0
- metadata +208 -0
data/src/_README.md
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
# journal
|
2
|
+
|
3
|
+
[![RubyGems.org](https://img.shields.io/gem/v/journal-cli)](https://rubygems.org/gems/journal-cli)
|
4
|
+
|
5
|
+
<!--README-->
|
6
|
+
A CLI for journaling to structured data, Markdown, and Day One
|
7
|
+
|
8
|
+
## Description
|
9
|
+
|
10
|
+
The `journal` command reads a journal definition and provides command line prompts to fill it out. The results are stored in a JSON database for each journal, and can optionally output to Markdown (individual files per entry, daily digest, or one large file for the journal).
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
First, you need [Gum](https://github.com/charmbracelet/gum) installed. The easiest way is with [Homebrew](https://brew.sh/):
|
15
|
+
|
16
|
+
```
|
17
|
+
$ brew install gum
|
18
|
+
```
|
19
|
+
|
20
|
+
Use RubyGems to install journal:
|
21
|
+
|
22
|
+
```
|
23
|
+
$ gem install journal-cli
|
24
|
+
```
|
25
|
+
|
26
|
+
If you run into errors, try running with the `--user-install` flag:
|
27
|
+
|
28
|
+
```
|
29
|
+
$ gem install --user-install journal-cli
|
30
|
+
```
|
31
|
+
|
32
|
+
> I've noticed lately with `asdf` that I have to run `asdf reshim` after installing gems containing binaries.
|
33
|
+
|
34
|
+
If you want to use Day One with journal, you'll need to [install the Day One CLI](https://dayoneapp.com/guides/tips-and-tutorials/command-line-interface-cli/).
|
35
|
+
|
36
|
+
## Configuration
|
37
|
+
|
38
|
+
A config must be created at `~/.config/journal/journals.yaml`:
|
39
|
+
|
40
|
+
```
|
41
|
+
$ mkdir -p ~/.config/journal
|
42
|
+
$ touch ~/.config/journal/journals.yaml
|
43
|
+
```
|
44
|
+
|
45
|
+
This file contains a YAML definition of your journal. Each journal gets a top-level key, which is what you'll specify it with on the command line. It gets a few settings, and then you define sections containing questions.
|
46
|
+
|
47
|
+
### Weather
|
48
|
+
|
49
|
+
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.
|
50
|
+
|
51
|
+
### Journal configuration
|
52
|
+
|
53
|
+
Edit the file at `~/.config/journal/journals.yaml` following this structure:
|
54
|
+
|
55
|
+
```yaml
|
56
|
+
daily: # journal key, will be used on the command line as `journal daily`
|
57
|
+
dayone: true # Enable or disable Day One integration
|
58
|
+
journal: Journal # Day One journal to add to (if using Day One integration)
|
59
|
+
markdown: daily # Type of Markdown file to create, false to skip (can be daily, individual, or digest)
|
60
|
+
title: Daily Journal # Title for every entry, date will be appended where needed
|
61
|
+
sections: # Required key
|
62
|
+
- title: null # The title for the section. If null, no section header will be created
|
63
|
+
key: journal # The key for the data collected, must be one word, alphanumeric characters and _ only
|
64
|
+
questions: # Required key
|
65
|
+
- prompt: How are you feeling? # The question to ask
|
66
|
+
key: journal # alphanumeric characters and _ only, will be nested in section key
|
67
|
+
type: multiline # The type of entry expected (numeric, string, or multiline)
|
68
|
+
```
|
69
|
+
|
70
|
+
Keys must be alphanumeric characters and `_` (underscore) only. Titles and questions can be anything, but if they contain a colon (:), you'll need to quote the string.
|
71
|
+
|
72
|
+
A more complex configuration file can contain multiple journals with multiple questions defined:
|
73
|
+
|
74
|
+
```yaml
|
75
|
+
zip: 55987 # Your zip code for weather integration
|
76
|
+
weather_api: XXXXXXXXXXXX # Your weatherapi.com API key
|
77
|
+
journals: # required key
|
78
|
+
mood: # name of the journal
|
79
|
+
journal: Mood Journal # Optional, Day One journal to add to
|
80
|
+
tags: [checkin] # Optional, array of tags to add to Day One entries
|
81
|
+
markdown: individual # Can be daily or individual, any other value will create a single file
|
82
|
+
dayone: true # true to log entries to Day One, false to skip
|
83
|
+
title: "Mood checkin %M" # The title of the entry. Use %M to insert AM or PM
|
84
|
+
sections: # required key
|
85
|
+
- title: Weather # Title of the section (will create template sections in Day One)
|
86
|
+
key: weather # the key to use in the structured data, will contain all of the answers
|
87
|
+
questions: # required key
|
88
|
+
- prompt: Current weather # The prompt shown on the command line, will also become a header in the journal entries (Markdown, Day One)
|
89
|
+
key: weather.forecast # if a key contains a dot, it will create nested data, e.g. `{ 'weather': { 'forecast': data } }`
|
90
|
+
type: weather # Set this to weather for weather data
|
91
|
+
- title: Health # New section
|
92
|
+
key: health
|
93
|
+
questions:
|
94
|
+
- prompt: Health rating
|
95
|
+
key: health.rating
|
96
|
+
type: numeric # type can be numeric, string, or multiline
|
97
|
+
min: 1 # Only need min/max definitions on numeric types (defaults 1-5)
|
98
|
+
max: 5
|
99
|
+
- prompt: Health notes
|
100
|
+
key: health.notes
|
101
|
+
type: multiline
|
102
|
+
- title: Journal # New section
|
103
|
+
key: journal
|
104
|
+
questions:
|
105
|
+
- prompt: Daily notes
|
106
|
+
key: notes
|
107
|
+
type: multiline
|
108
|
+
daily: # New journal
|
109
|
+
journal: Journal
|
110
|
+
markdown: daily
|
111
|
+
dayone: true
|
112
|
+
title: Daily Journal
|
113
|
+
sections:
|
114
|
+
- title: null
|
115
|
+
key: journal
|
116
|
+
questions:
|
117
|
+
- prompt: How are you feeling?
|
118
|
+
key: journal
|
119
|
+
type: multiline
|
120
|
+
```
|
121
|
+
|
122
|
+
A journal must contain a `sections` key, and each section must contain a `questions` key with an array of questions. Each question must (at minimum) have a `prompt`, `key`, and `type`.
|
123
|
+
|
124
|
+
## Usage
|
125
|
+
|
126
|
+
Once your configuration file is set up, you can just run `journal JOURNAL_KEY` to begin prompting for the answers to the configured questions.
|
127
|
+
|
128
|
+
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 `daily` or `individual` Markdown formats, entries will be written to Markdown files in `~/.local/share/journal/entries/[KEY]`, either in a `%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].md`.
|
129
|
+
|
130
|
+
At present there's no tool for querying the dataset created. You just need to parse the JSON and use your language of choice to extract the data. Numeric entries are stored as numbers, and every entry is timestamped, so you should be able to do some advanced analysis once you have enough data.
|
131
|
+
|
132
|
+
<!--END README-->
|
133
|
+
## Contributing
|
134
|
+
|
135
|
+
Please submit and comment on bug reports and feature requests.
|
136
|
+
|
137
|
+
To submit a patch:
|
138
|
+
|
139
|
+
1. Fork it (https://github.com/ttscoff/journal-cli/fork).
|
140
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
141
|
+
3. Make changes.
|
142
|
+
4. Commit your changes (`git commit -am 'Add some feature'`).
|
143
|
+
5. Push to the branch (`git push origin my-new-feature`).
|
144
|
+
6. Create a new Pull Request.
|
145
|
+
|
146
|
+
## License
|
147
|
+
|
148
|
+
This Ruby gem is licensed under the MIT license.
|
149
|
+
|
150
|
+
## Warranty
|
151
|
+
|
152
|
+
This software is provided by the copyright holders and contributors "as is" and
|
153
|
+
any express or implied warranties, including, but not limited to, the implied
|
154
|
+
warranties of merchantability and fitness for a particular purpose are
|
155
|
+
disclaimed. In no event shall the copyright holder or contributors be liable for
|
156
|
+
any direct, indirect, incidental, special, exemplary, or consequential damages
|
157
|
+
(including, but not limited to, procurement of substitute goods or services;
|
158
|
+
loss of use, data, or profits; or business interruption) however caused and on
|
159
|
+
any theory of liability, whether in contract, strict liability, or tort
|
160
|
+
(including negligence or otherwise) arising in any way out of the use of this
|
161
|
+
software, even if advised of the possibility of such damage.
|
metadata
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: journal-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brett Terpstra
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-09-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gem-release
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: parse_gemspec-cli
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '13.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '13.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.21'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.21'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov-console
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.9'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.9'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: standard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.3'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.3'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: chronic
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.10'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 0.10.2
|
135
|
+
type: :runtime
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0.10'
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 0.10.2
|
145
|
+
description: A CLI for journaling to structured data, Markdown, and Day One
|
146
|
+
email: me@brettterpstra.com
|
147
|
+
executables:
|
148
|
+
- journal
|
149
|
+
extensions: []
|
150
|
+
extra_rdoc_files: []
|
151
|
+
files:
|
152
|
+
- ".devcontainer/Dockerfile"
|
153
|
+
- ".devcontainer/devcontainer.json"
|
154
|
+
- ".editorconfig"
|
155
|
+
- ".github/actions/setup/action.yml"
|
156
|
+
- ".github/workflows/_build.yml"
|
157
|
+
- ".github/workflows/_publish.yml"
|
158
|
+
- ".github/workflows/check.yml"
|
159
|
+
- ".github/workflows/format.yml"
|
160
|
+
- ".github/workflows/publish.yml"
|
161
|
+
- ".github/workflows/version.yml"
|
162
|
+
- ".gitignore"
|
163
|
+
- ".rspec"
|
164
|
+
- ".ruby-version"
|
165
|
+
- CHANGELOG.md
|
166
|
+
- Gemfile
|
167
|
+
- Gemfile.lock
|
168
|
+
- LICENSE.txt
|
169
|
+
- README.md
|
170
|
+
- README.rdoc
|
171
|
+
- Rakefile
|
172
|
+
- bin/journal
|
173
|
+
- lib/journal-cli.rb
|
174
|
+
- lib/journal-cli/checkin.rb
|
175
|
+
- lib/journal-cli/data.rb
|
176
|
+
- lib/journal-cli/version.rb
|
177
|
+
- lib/journal-cli/weather.rb
|
178
|
+
- src/_README.md
|
179
|
+
homepage: https://github.com/ttscoff/journal-cli
|
180
|
+
licenses:
|
181
|
+
- MIT
|
182
|
+
metadata:
|
183
|
+
homepage_uri: https://github.com/ttscoff/journal-cli
|
184
|
+
source_code_uri: https://github.com/ttscoff/journal-cli
|
185
|
+
bug_tracker_uri: https://github.com/ttscoff/journal-cli/issues
|
186
|
+
changelog_uri: https://github.com/ttscoff/journal-cli/blob/main/CHANGELOG.md
|
187
|
+
github_repo: git@github.com:ttscoff/journal-cli.git
|
188
|
+
post_install_message:
|
189
|
+
rdoc_options: []
|
190
|
+
require_paths:
|
191
|
+
- lib
|
192
|
+
- lib
|
193
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: 3.0.0
|
198
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: '0'
|
203
|
+
requirements: []
|
204
|
+
rubygems_version: 3.4.0.dev
|
205
|
+
signing_key:
|
206
|
+
specification_version: 4
|
207
|
+
summary: journal
|
208
|
+
test_files: []
|