@nickchristensen/cliftin 1.0.2 → 1.1.1

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.
package/README.md CHANGED
@@ -5,28 +5,40 @@ CLIftin: A read-only CLI for Liftin'
5
5
 
6
6
 
7
7
  [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
8
- [![Version](https://img.shields.io/npm/v/cliftin.svg)](https://npmjs.org/package/cliftin)
9
- [![Downloads/week](https://img.shields.io/npm/dw/cliftin.svg)](https://npmjs.org/package/cliftin)
8
+ [![Version](https://img.shields.io/npm/v/@nickchristensen/cliftin.svg)](https://npmjs.org/package/cliftin)
9
+ [![Downloads/week](https://img.shields.io/npm/dw/@nickchristensen/cliftin.svg)](https://npmjs.org/package/cliftin)
10
10
 
11
11
 
12
12
  <!-- toc -->
13
+ * [Configuration](#configuration)
13
14
  * [Usage](#usage)
14
15
  * [Commands](#commands)
15
16
  <!-- tocstop -->
17
+
18
+ # Configuration
19
+
20
+ cliftin reads your Liftin database directly. By default it looks for the Liftin app's SQLite file at:
21
+
22
+ ```
23
+ $HOME/Library/Containers/com.nstrm.Bello/Data/Library/Application Support/Liftin/BelloDataModel.sqlite
24
+ ```
25
+
26
+ To use a different path, set `LIFTIN_DB_PATH` in your environment or in a `.env.local` file at the project root:
27
+
28
+ ```sh
29
+ LIFTIN_DB_PATH=/path/to/BelloDataModel.sqlite
30
+ ```
31
+
16
32
  # Usage
17
- <!-- usage -->
18
33
  ```sh-session
19
34
  $ npm install -g @nickchristensen/cliftin
20
35
  $ cliftin COMMAND
21
36
  running command...
22
- $ cliftin (--version)
23
- @nickchristensen/cliftin/1.0.2 darwin-arm64 node-v25.6.0
24
37
  $ cliftin --help [COMMAND]
25
38
  USAGE
26
39
  $ cliftin COMMAND
27
40
  ...
28
41
  ```
29
- <!-- usagestop -->
30
42
  # Commands
31
43
  <!-- commands -->
32
44
  * [`cliftin exercises list`](#cliftin-exercises-list)
@@ -60,7 +72,7 @@ DESCRIPTION
60
72
  List exercises
61
73
  ```
62
74
 
63
- _See code: [src/commands/exercises/list.ts](https://github.com/nickchristensen/cliftin/blob/v1.0.2/src/commands/exercises/list.ts)_
75
+ _See code: [src/commands/exercises/list.ts](https://github.com/nickchristensen/cliftin/blob/v1.1.1/src/commands/exercises/list.ts)_
64
76
 
65
77
  ## `cliftin exercises show SELECTOR`
66
78
 
@@ -94,7 +106,7 @@ DESCRIPTION
94
106
  Show one exercise detail and history
95
107
  ```
96
108
 
97
- _See code: [src/commands/exercises/show.ts](https://github.com/nickchristensen/cliftin/blob/v1.0.2/src/commands/exercises/show.ts)_
109
+ _See code: [src/commands/exercises/show.ts](https://github.com/nickchristensen/cliftin/blob/v1.1.1/src/commands/exercises/show.ts)_
98
110
 
99
111
  ## `cliftin help [COMMAND]`
100
112
 
@@ -131,7 +143,7 @@ DESCRIPTION
131
143
  List programs
132
144
  ```
133
145
 
134
- _See code: [src/commands/programs/list.ts](https://github.com/nickchristensen/cliftin/blob/v1.0.2/src/commands/programs/list.ts)_
146
+ _See code: [src/commands/programs/list.ts](https://github.com/nickchristensen/cliftin/blob/v1.1.1/src/commands/programs/list.ts)_
135
147
 
136
148
  ## `cliftin programs show [SELECTOR]`
137
149
 
@@ -155,7 +167,7 @@ DESCRIPTION
155
167
  Show one program hierarchy
156
168
  ```
157
169
 
158
- _See code: [src/commands/programs/show.ts](https://github.com/nickchristensen/cliftin/blob/v1.0.2/src/commands/programs/show.ts)_
170
+ _See code: [src/commands/programs/show.ts](https://github.com/nickchristensen/cliftin/blob/v1.1.1/src/commands/programs/show.ts)_
159
171
 
160
172
  ## `cliftin workouts list`
161
173
 
@@ -182,7 +194,7 @@ DESCRIPTION
182
194
  List workouts
183
195
  ```
184
196
 
185
- _See code: [src/commands/workouts/list.ts](https://github.com/nickchristensen/cliftin/blob/v1.0.2/src/commands/workouts/list.ts)_
197
+ _See code: [src/commands/workouts/list.ts](https://github.com/nickchristensen/cliftin/blob/v1.1.1/src/commands/workouts/list.ts)_
186
198
 
187
199
  ## `cliftin workouts show WORKOUTID`
188
200
 
@@ -202,5 +214,5 @@ DESCRIPTION
202
214
  Show one workout with exercises and sets
203
215
  ```
204
216
 
205
- _See code: [src/commands/workouts/show.ts](https://github.com/nickchristensen/cliftin/blob/v1.0.2/src/commands/workouts/show.ts)_
217
+ _See code: [src/commands/workouts/show.ts](https://github.com/nickchristensen/cliftin/blob/v1.1.1/src/commands/workouts/show.ts)_
206
218
  <!-- commandsstop -->
@@ -0,0 +1,3 @@
1
+ import { Hook } from '@oclif/core';
2
+ declare const hook: Hook.Init;
3
+ export default hook;
@@ -0,0 +1,8 @@
1
+ const hook = async function (options) {
2
+ if (['--version', '-v'].includes(process.argv[2])) {
3
+ this.log(`v${options.config.version}`);
4
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit
5
+ process.exit(0);
6
+ }
7
+ };
8
+ export default hook;
@@ -10,15 +10,13 @@ function loadEnv() {
10
10
  }
11
11
  export function getDbPath() {
12
12
  loadEnv();
13
- const path = process.env.LIFTIN_DB_PATH;
14
- if (!path) {
15
- throw new Error('Missing LIFTIN_DB_PATH. Add it to .env.local, for example: LIFTIN_DB_PATH=/Users/nick/code/cliftin/data/BelloDataModel.sqlite');
16
- }
13
+ const defaultPath = `${process.env.HOME}/Library/Containers/com.nstrm.Bello/Data/Library/Application Support/Liftin/BelloDataModel.sqlite`;
14
+ const path = process.env.LIFTIN_DB_PATH ?? defaultPath;
17
15
  try {
18
16
  accessSync(path, constants.R_OK);
19
17
  }
20
18
  catch {
21
- throw new Error(`Database file is not readable at LIFTIN_DB_PATH=${path}`);
19
+ throw new Error(`Database file is not readable at path=${path}`);
22
20
  }
23
21
  return path;
24
22
  }
@@ -382,5 +382,5 @@
382
382
  ]
383
383
  }
384
384
  },
385
- "version": "1.0.2"
385
+ "version": "1.1.1"
386
386
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nickchristensen/cliftin",
3
3
  "description": "CLIftin: A read-only CLI for Liftin'",
4
- "version": "1.0.2",
4
+ "version": "1.1.1",
5
5
  "author": "Nick Christensen",
6
6
  "bin": {
7
7
  "cliftin": "./bin/run.js"
@@ -57,6 +57,9 @@
57
57
  "flagSortOrder": "none"
58
58
  },
59
59
  "commands": "./dist/commands",
60
+ "hooks": {
61
+ "init": "./dist/hooks/init"
62
+ },
60
63
  "plugins": [
61
64
  "@oclif/plugin-help"
62
65
  ],