@beauraines/toggl-cli 0.10.11 → 0.10.13
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/.eslintrc.json +1 -1
- package/.github/dependabot.yml +5 -0
- package/CHANGELOG.md +9 -0
- package/cmds/continue.mjs +3 -2
- package/cmds/ls.mjs +16 -4
- package/cmds/today.mjs +19 -3
- package/cmds/weekly.mjs +19 -3
- package/package.json +3 -2
package/.eslintrc.json
CHANGED
package/.github/dependabot.yml
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.10.13](https://github.com/beauraines/toggl-cli/compare/v0.10.12...v0.10.13) (2023-04-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Improve table layout ([4652fc3](https://github.com/beauraines/toggl-cli/commit/4652fc3f5e54ca6f0031dfcc035746147b028a5d)), closes [#56](https://github.com/beauraines/toggl-cli/issues/56)
|
|
11
|
+
|
|
12
|
+
### [0.10.12](https://github.com/beauraines/toggl-cli/compare/v0.10.11...v0.10.12) (2023-03-23)
|
|
13
|
+
|
|
5
14
|
### [0.10.11](https://github.com/beauraines/toggl-cli/compare/v0.10.10...v0.10.11) (2023-03-19)
|
|
6
15
|
|
|
7
16
|
|
package/cmds/continue.mjs
CHANGED
|
@@ -24,12 +24,13 @@ export const handler = async function (argv) {
|
|
|
24
24
|
}
|
|
25
25
|
) // Gets time entries for last 14 days, up to 1000 entries
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// Sort to guarantee its most recent to oldest)
|
|
28
|
+
timeEntries.sort((a, b) => dayjs(b.start).toDate() - dayjs(a.start).toDate())
|
|
28
29
|
|
|
29
30
|
let matchingTimeEntry
|
|
30
31
|
switch (argv.description) {
|
|
31
32
|
case undefined:
|
|
32
|
-
matchingTimeEntry = timeEntries
|
|
33
|
+
matchingTimeEntry = timeEntries[0]
|
|
33
34
|
break
|
|
34
35
|
default:
|
|
35
36
|
{ const searchName = argv.description.toLowerCase()
|
package/cmds/ls.mjs
CHANGED
|
@@ -40,11 +40,23 @@ export const handler = async function (argv) {
|
|
|
40
40
|
})
|
|
41
41
|
|
|
42
42
|
const table = new Table({
|
|
43
|
-
head: ['
|
|
43
|
+
head: ['Description', 'Start', 'Stop', 'Duration'],
|
|
44
|
+
chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' }
|
|
44
45
|
})
|
|
45
|
-
for (
|
|
46
|
-
|
|
46
|
+
for (let i = 0; i < report.length; i++) {
|
|
47
|
+
// First row chars
|
|
48
|
+
const chars = {
|
|
49
|
+
midMid: '┼',
|
|
50
|
+
mid: '─',
|
|
51
|
+
leftMid: '├',
|
|
52
|
+
rightMid: '┤'
|
|
53
|
+
}
|
|
54
|
+
const entry = report[i]
|
|
55
|
+
if (i === 0) {
|
|
56
|
+
table.push([entry.description, entry.start, entry.stop, entry.duration].map((content) => ({ content, chars })))
|
|
57
|
+
} else {
|
|
58
|
+
table.push([entry.description, entry.start, entry.stop, entry.duration])
|
|
59
|
+
}
|
|
47
60
|
}
|
|
48
61
|
console.log(table.toString())
|
|
49
|
-
// console.table(report, ['description', 'start', 'stop', 'duration'])
|
|
50
62
|
}
|
package/cmds/today.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Client from '../client.js'
|
|
2
|
+
import chalk from 'chalk'
|
|
2
3
|
import dayjs from 'dayjs'
|
|
3
4
|
import { getWorkspace, getProjects, formatDuration, formatDurationAsTime } from '../utils.js'
|
|
4
5
|
import dur from 'dayjs/plugin/duration.js'
|
|
@@ -79,10 +80,25 @@ function displayDailyReport (report, format) {
|
|
|
79
80
|
case 'table':
|
|
80
81
|
default:
|
|
81
82
|
const table = new Table({
|
|
82
|
-
head: ['Project', 'Duration']
|
|
83
|
+
head: ['Project', 'Duration'],
|
|
84
|
+
chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' }
|
|
83
85
|
})
|
|
84
|
-
for (
|
|
85
|
-
|
|
86
|
+
for (let i = 0; i < report.length; i++) {
|
|
87
|
+
// First row chars
|
|
88
|
+
const chars = {
|
|
89
|
+
midMid: '┼',
|
|
90
|
+
mid: '─',
|
|
91
|
+
leftMid: '├',
|
|
92
|
+
rightMid: '┤'
|
|
93
|
+
}
|
|
94
|
+
const project = report[i]
|
|
95
|
+
if (i == 0) {
|
|
96
|
+
table.push([project.project_name, project.duration_formatted].map((content) => ({ content: chalk.grey(content), chars })))
|
|
97
|
+
} else if ( i == report.length - 1) {
|
|
98
|
+
table.push([project.project_name, project.duration_formatted].map((content) => ( {content: chalk.bold(content), chars })))
|
|
99
|
+
} else {
|
|
100
|
+
table.push([chalk.grey(project.project_name), chalk.grey(project.duration_formatted)])
|
|
101
|
+
}
|
|
86
102
|
}
|
|
87
103
|
console.log(table.toString())
|
|
88
104
|
break
|
package/cmds/weekly.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Client from '../client.js'
|
|
2
|
+
import chalk from 'chalk'
|
|
2
3
|
import { getWorkspace, formatDuration, getProjectById } from '../utils.js'
|
|
3
4
|
import dayjs from 'dayjs'
|
|
4
5
|
import dur from 'dayjs/plugin/duration.js'
|
|
@@ -58,10 +59,25 @@ export const handler = async function (argv) {
|
|
|
58
59
|
|
|
59
60
|
const head = Object.keys(reportData[0])
|
|
60
61
|
const table = new Table({
|
|
61
|
-
head
|
|
62
|
+
head,
|
|
63
|
+
chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' }
|
|
62
64
|
})
|
|
63
|
-
for (
|
|
64
|
-
|
|
65
|
+
for (let i = 0; i < reportData.length; i++) {
|
|
66
|
+
// First row chars
|
|
67
|
+
const chars = {
|
|
68
|
+
midMid: '┼',
|
|
69
|
+
mid: '─',
|
|
70
|
+
leftMid: '├',
|
|
71
|
+
rightMid: '┤'
|
|
72
|
+
}
|
|
73
|
+
const project = reportData[i]
|
|
74
|
+
if (i == 0 ) {
|
|
75
|
+
table.push(Object.values(project).map((content) => ({ content: chalk.grey(content), chars })))
|
|
76
|
+
} else if ( i == reportData.length - 1) {
|
|
77
|
+
table.push(Object.values(project).map((content) => ( {content: chalk.bold(content), chars })))
|
|
78
|
+
} else {
|
|
79
|
+
table.push(Object.values(project).map((content) => ({ content: chalk.grey(content) })))
|
|
80
|
+
}
|
|
65
81
|
}
|
|
66
82
|
console.log(table.toString())
|
|
67
83
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beauraines/toggl-cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "jest",
|
|
11
|
-
"lint": "eslint . ./**/*.js ./**/*.
|
|
11
|
+
"lint": "eslint . ./**/*.js ./**/*.mjs",
|
|
12
12
|
"lint:fix": "eslint . ./**/*.js ./**/*.mjs --fix",
|
|
13
13
|
"release": "standard-version",
|
|
14
14
|
"should-release": "should-release"
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"chalk": "^4.0.0",
|
|
33
34
|
"cli-table3": "^0.6.3",
|
|
34
35
|
"dayjs": "^1.11.6",
|
|
35
36
|
"debug": "^4.3.4",
|