@nickchristensen/cliftin 1.3.0 → 2.0.0
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 +7 -7
- package/dist/commands/exercises/list.js +6 -2
- package/dist/commands/exercises/show.js +3 -12
- package/dist/commands/programs/list.js +6 -2
- package/dist/commands/workouts/list.js +3 -2
- package/dist/lib/json-weight.js +32 -11
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ DESCRIPTION
|
|
|
73
73
|
List exercises
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
_See code: [src/commands/exercises/list.ts](https://github.com/nickchristensen/cliftin/blob/
|
|
76
|
+
_See code: [src/commands/exercises/list.ts](https://github.com/nickchristensen/cliftin/blob/v2.0.0/src/commands/exercises/list.ts)_
|
|
77
77
|
|
|
78
78
|
## `cliftin exercises show SELECTOR`
|
|
79
79
|
|
|
@@ -107,7 +107,7 @@ DESCRIPTION
|
|
|
107
107
|
Show one exercise detail and history
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
_See code: [src/commands/exercises/show.ts](https://github.com/nickchristensen/cliftin/blob/
|
|
110
|
+
_See code: [src/commands/exercises/show.ts](https://github.com/nickchristensen/cliftin/blob/v2.0.0/src/commands/exercises/show.ts)_
|
|
111
111
|
|
|
112
112
|
## `cliftin help [COMMAND]`
|
|
113
113
|
|
|
@@ -144,7 +144,7 @@ DESCRIPTION
|
|
|
144
144
|
List programs
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
_See code: [src/commands/programs/list.ts](https://github.com/nickchristensen/cliftin/blob/
|
|
147
|
+
_See code: [src/commands/programs/list.ts](https://github.com/nickchristensen/cliftin/blob/v2.0.0/src/commands/programs/list.ts)_
|
|
148
148
|
|
|
149
149
|
## `cliftin programs show [SELECTOR]`
|
|
150
150
|
|
|
@@ -164,7 +164,7 @@ DESCRIPTION
|
|
|
164
164
|
Show one program hierarchy
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
_See code: [src/commands/programs/show.ts](https://github.com/nickchristensen/cliftin/blob/
|
|
167
|
+
_See code: [src/commands/programs/show.ts](https://github.com/nickchristensen/cliftin/blob/v2.0.0/src/commands/programs/show.ts)_
|
|
168
168
|
|
|
169
169
|
## `cliftin workouts list`
|
|
170
170
|
|
|
@@ -191,7 +191,7 @@ DESCRIPTION
|
|
|
191
191
|
List workouts
|
|
192
192
|
```
|
|
193
193
|
|
|
194
|
-
_See code: [src/commands/workouts/list.ts](https://github.com/nickchristensen/cliftin/blob/
|
|
194
|
+
_See code: [src/commands/workouts/list.ts](https://github.com/nickchristensen/cliftin/blob/v2.0.0/src/commands/workouts/list.ts)_
|
|
195
195
|
|
|
196
196
|
## `cliftin workouts next`
|
|
197
197
|
|
|
@@ -208,7 +208,7 @@ DESCRIPTION
|
|
|
208
208
|
Show the up-next routine from the active program
|
|
209
209
|
```
|
|
210
210
|
|
|
211
|
-
_See code: [src/commands/workouts/next.ts](https://github.com/nickchristensen/cliftin/blob/
|
|
211
|
+
_See code: [src/commands/workouts/next.ts](https://github.com/nickchristensen/cliftin/blob/v2.0.0/src/commands/workouts/next.ts)_
|
|
212
212
|
|
|
213
213
|
## `cliftin workouts show [WORKOUTID]`
|
|
214
214
|
|
|
@@ -228,5 +228,5 @@ DESCRIPTION
|
|
|
228
228
|
Show one workout with exercises and sets
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
-
_See code: [src/commands/workouts/show.ts](https://github.com/nickchristensen/cliftin/blob/
|
|
231
|
+
_See code: [src/commands/workouts/show.ts](https://github.com/nickchristensen/cliftin/blob/v2.0.0/src/commands/workouts/show.ts)_
|
|
232
232
|
<!-- commandsstop -->
|
|
@@ -36,8 +36,12 @@ export default class Exercises extends Command {
|
|
|
36
36
|
name: flags.name,
|
|
37
37
|
sort: flags.sort,
|
|
38
38
|
});
|
|
39
|
-
if (this.jsonEnabled())
|
|
40
|
-
return exercises
|
|
39
|
+
if (this.jsonEnabled()) {
|
|
40
|
+
return exercises.map(({ id, ...exercise }) => ({
|
|
41
|
+
...exercise,
|
|
42
|
+
exerciseId: id,
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
41
45
|
this.log(renderTable(exercises.map((exercise) => ({
|
|
42
46
|
equipment: exercise.equipment,
|
|
43
47
|
id: exercise.id,
|
|
@@ -64,20 +64,11 @@ export default class ExercisesShow extends Command {
|
|
|
64
64
|
})),
|
|
65
65
|
topWeight: withWeightUnit(row.topWeight, historyUnitPreference),
|
|
66
66
|
}));
|
|
67
|
+
const { id: detailId, ...exerciseDetail } = detail;
|
|
67
68
|
return {
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
exerciseId: detailId,
|
|
70
|
+
...exerciseDetail,
|
|
70
71
|
history,
|
|
71
|
-
id: detail.id,
|
|
72
|
-
name: detail.name,
|
|
73
|
-
perceptionScale: detail.perceptionScale,
|
|
74
|
-
primaryMuscles: detail.primaryMuscles,
|
|
75
|
-
recentRoutines: detail.recentRoutines,
|
|
76
|
-
secondaryMuscles: detail.secondaryMuscles,
|
|
77
|
-
supports1RM: detail.supports1RM,
|
|
78
|
-
timerBased: detail.timerBased,
|
|
79
|
-
totalRoutines: detail.totalRoutines,
|
|
80
|
-
totalWorkouts: detail.totalWorkouts,
|
|
81
72
|
};
|
|
82
73
|
}
|
|
83
74
|
this.log(`[${detail.id}] ${detail.name ?? '(unnamed)'}`);
|
|
@@ -10,8 +10,12 @@ export default class Programs extends Command {
|
|
|
10
10
|
const context = openDb();
|
|
11
11
|
try {
|
|
12
12
|
const programs = await listPrograms(context.db);
|
|
13
|
-
if (this.jsonEnabled())
|
|
14
|
-
return programs
|
|
13
|
+
if (this.jsonEnabled()) {
|
|
14
|
+
return programs.map(({ id, ...program }) => ({
|
|
15
|
+
...program,
|
|
16
|
+
programId: id,
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
15
19
|
this.log(renderTable(programs.map((program) => ({
|
|
16
20
|
dateAdded: program.dateAdded,
|
|
17
21
|
id: program.id,
|
|
@@ -35,12 +35,13 @@ export default class Workouts extends Command {
|
|
|
35
35
|
to: flags.to,
|
|
36
36
|
});
|
|
37
37
|
if (this.jsonEnabled()) {
|
|
38
|
-
return workouts.map((workout) => ({
|
|
38
|
+
return workouts.map(({ duration, id, ...workout }) => ({
|
|
39
39
|
...workout,
|
|
40
40
|
duration: {
|
|
41
41
|
unit: 'seconds',
|
|
42
|
-
value:
|
|
42
|
+
value: duration,
|
|
43
43
|
},
|
|
44
|
+
workoutId: id,
|
|
44
45
|
}));
|
|
45
46
|
}
|
|
46
47
|
this.log(renderTable(workouts.map((workout) => {
|
package/dist/lib/json-weight.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { withWeightUnit } from './units.js';
|
|
2
|
+
function omitId(value) {
|
|
3
|
+
return Object.fromEntries(Object.entries(value).filter(([key]) => key !== 'id'));
|
|
4
|
+
}
|
|
2
5
|
export function serializeExerciseHistoryRowsWithWeightUnits(rows, unitPreference) {
|
|
3
6
|
return rows.map((row) => ({
|
|
4
7
|
...row,
|
|
@@ -6,45 +9,60 @@ export function serializeExerciseHistoryRowsWithWeightUnits(rows, unitPreference
|
|
|
6
9
|
}));
|
|
7
10
|
}
|
|
8
11
|
export function serializeProgramDetailWithWeightUnits(detail, unitPreference) {
|
|
12
|
+
const program = omitId(detail.program);
|
|
9
13
|
return {
|
|
10
|
-
...detail,
|
|
14
|
+
program: { ...program, programId: detail.program.id },
|
|
11
15
|
weeks: detail.weeks.map((week) => ({
|
|
12
|
-
...week,
|
|
13
16
|
routines: week.routines.map((routine) => ({
|
|
14
|
-
...routine,
|
|
17
|
+
...omitId(routine),
|
|
15
18
|
exercises: routine.exercises.map((exercise) => ({
|
|
16
|
-
...exercise,
|
|
19
|
+
...omitId(exercise),
|
|
20
|
+
exerciseId: exercise.id,
|
|
17
21
|
plannedWeight: withWeightUnit(exercise.plannedWeight, unitPreference),
|
|
18
22
|
sets: exercise.sets.map((set) => ({
|
|
19
|
-
...set,
|
|
23
|
+
...omitId(set),
|
|
24
|
+
setId: set.id,
|
|
20
25
|
weight: withWeightUnit(set.weight, unitPreference),
|
|
21
26
|
})),
|
|
22
27
|
})),
|
|
28
|
+
routineId: routine.id,
|
|
23
29
|
})),
|
|
30
|
+
weekId: week.id,
|
|
24
31
|
})),
|
|
25
32
|
};
|
|
26
33
|
}
|
|
27
34
|
export function serializeNextWorkoutDetailWithWeightUnits(detail, unitPreference) {
|
|
35
|
+
const program = omitId(detail.program);
|
|
28
36
|
return {
|
|
29
|
-
...detail,
|
|
37
|
+
program: { ...program, programId: detail.program.id },
|
|
30
38
|
routine: {
|
|
31
|
-
...detail.routine,
|
|
39
|
+
...omitId(detail.routine),
|
|
32
40
|
exercises: detail.routine.exercises.map((exercise) => ({
|
|
33
|
-
...exercise,
|
|
41
|
+
...omitId(exercise),
|
|
42
|
+
exerciseId: exercise.id,
|
|
34
43
|
plannedWeight: withWeightUnit(exercise.plannedWeight, unitPreference),
|
|
35
44
|
sets: exercise.sets.map((set) => ({
|
|
36
|
-
...set,
|
|
45
|
+
...omitId(set),
|
|
46
|
+
setId: set.id,
|
|
37
47
|
weight: withWeightUnit(set.weight, unitPreference),
|
|
38
48
|
})),
|
|
39
49
|
})),
|
|
50
|
+
routineId: detail.routine.id,
|
|
51
|
+
},
|
|
52
|
+
week: {
|
|
53
|
+
number: detail.week.number,
|
|
54
|
+
weekId: detail.week.id,
|
|
40
55
|
},
|
|
41
56
|
};
|
|
42
57
|
}
|
|
43
58
|
export function serializeWorkoutDetailWithWeightUnits(detail, unitPreference) {
|
|
44
59
|
return {
|
|
45
|
-
|
|
60
|
+
date: detail.date,
|
|
61
|
+
duration: detail.duration,
|
|
46
62
|
exercises: detail.exercises.map((exercise) => ({
|
|
47
|
-
|
|
63
|
+
exerciseId: exercise.exerciseId,
|
|
64
|
+
exerciseResultId: exercise.exerciseResultId,
|
|
65
|
+
name: exercise.name,
|
|
48
66
|
sets: exercise.sets.map((set) => ({
|
|
49
67
|
reps: set.reps,
|
|
50
68
|
rpe: set.rpe,
|
|
@@ -54,5 +72,8 @@ export function serializeWorkoutDetailWithWeightUnits(detail, unitPreference) {
|
|
|
54
72
|
weight: withWeightUnit(set.weight, unitPreference),
|
|
55
73
|
})),
|
|
56
74
|
})),
|
|
75
|
+
program: detail.program,
|
|
76
|
+
routine: detail.routine,
|
|
77
|
+
workoutId: detail.id,
|
|
57
78
|
};
|
|
58
79
|
}
|
package/oclif.manifest.json
CHANGED
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": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": "Nick Christensen",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cliftin": "./bin/run.js"
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"@oclif/test": "^4",
|
|
23
23
|
"@types/better-sqlite3": "^7.6.13",
|
|
24
24
|
"@types/chai": "^4",
|
|
25
|
-
"@types/mocha": "^10",
|
|
25
|
+
"@types/mocha": "^10.0.10",
|
|
26
26
|
"@types/node": "^24.10.13",
|
|
27
27
|
"chai": "^4",
|
|
28
28
|
"eslint": "^9",
|
|
29
29
|
"eslint-config-oclif": "^6",
|
|
30
30
|
"eslint-config-prettier": "^10",
|
|
31
|
-
"mocha": "^
|
|
31
|
+
"mocha": "^11.7.5",
|
|
32
32
|
"oclif": "^4",
|
|
33
33
|
"shx": "^0.3.3",
|
|
34
34
|
"simple-git-hooks": "^2.13.1",
|