@beauraines/toggl-cli 0.10.20 → 0.10.21
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/CHANGELOG.md +7 -0
- package/cmds/ls.mjs +15 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
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.21](https://github.com/beauraines/toggl-cli/compare/v0.10.20...v0.10.21) (2023-07-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **ls:** adds details to time entry listing ([7ad05c7](https://github.com/beauraines/toggl-cli/commit/7ad05c797729bbaa34dc2a6be99397e1a01c24a2)), closes [#72](https://github.com/beauraines/toggl-cli/issues/72)
|
|
11
|
+
|
|
5
12
|
### [0.10.20](https://github.com/beauraines/toggl-cli/compare/v0.10.19...v0.10.20) (2023-07-08)
|
|
6
13
|
|
|
7
14
|
### [0.10.19](https://github.com/beauraines/toggl-cli/compare/v0.10.18...v0.10.19) (2023-07-08)
|
package/cmds/ls.mjs
CHANGED
|
@@ -27,20 +27,31 @@ export const handler = async function (argv) {
|
|
|
27
27
|
debug(searchString)
|
|
28
28
|
timeEntries = timeEntries.filter(x => x.description.includes(searchString))
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
const workspaces = await client.workspaces.list()
|
|
32
|
+
const workspace = workspaces[0]
|
|
33
|
+
debug('Workspace: ' + workspace.name)
|
|
34
|
+
debug('id: ' + workspace.id)
|
|
35
|
+
const projects = await client.workspaces.projects(workspace.id)
|
|
36
|
+
|
|
30
37
|
const report = []
|
|
31
38
|
timeEntries.forEach(element => {
|
|
39
|
+
console.log(element)
|
|
32
40
|
report.push(
|
|
33
41
|
{
|
|
34
42
|
description: element.description,
|
|
43
|
+
project: projects.filter(p => p.id == element.project_id)[0]?.name,
|
|
44
|
+
project_id: projects.filter(p => p.id == element.project_id)[0]?.id,
|
|
35
45
|
start: convertUtcTime(element.start),
|
|
36
46
|
stop: convertUtcTime(element.stop),
|
|
37
|
-
duration: formatDuration(element.duration * 1000)
|
|
47
|
+
duration: formatDuration(element.duration * 1000),
|
|
48
|
+
id: element.id
|
|
38
49
|
}
|
|
39
50
|
)
|
|
40
51
|
})
|
|
41
52
|
|
|
42
53
|
const table = new Table({
|
|
43
|
-
head: ['Description', 'Start', 'Stop', 'Duration'],
|
|
54
|
+
head: ['Description', 'Project', 'Start', 'Stop', 'Duration', 'Time Entry ID'],
|
|
44
55
|
chars: { mid: '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' }
|
|
45
56
|
})
|
|
46
57
|
for (let i = 0; i < report.length; i++) {
|
|
@@ -53,9 +64,9 @@ export const handler = async function (argv) {
|
|
|
53
64
|
}
|
|
54
65
|
const entry = report[i]
|
|
55
66
|
if (i === 0) {
|
|
56
|
-
table.push([entry.description, entry.start, entry.stop, entry.duration].map((content) => ({ content, chars })))
|
|
67
|
+
table.push([entry.description, entry.project, entry.start, entry.stop, entry.duration, entry.id].map((content) => ({ content, chars })))
|
|
57
68
|
} else {
|
|
58
|
-
table.push([entry.description, entry.start, entry.stop, entry.duration])
|
|
69
|
+
table.push([entry.description, entry.project, entry.start, entry.stop, entry.duration, entry.id])
|
|
59
70
|
}
|
|
60
71
|
}
|
|
61
72
|
console.log(table.toString())
|