@beauraines/toggl-cli 0.10.7 → 0.10.9

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 CHANGED
@@ -12,6 +12,6 @@
12
12
  "sourceType": "module"
13
13
  },
14
14
  "rules": {
15
- "allowTernary": true
15
+ "no-unused-expressions": "warn"
16
16
  }
17
17
  }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
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.9](https://github.com/beauraines/toggl-cli/compare/v0.10.7...v0.10.9) (2023-03-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * improves report table output ([#46](https://github.com/beauraines/toggl-cli/issues/46)) ([4e90a80](https://github.com/beauraines/toggl-cli/commit/4e90a80a2d9c4e3e0a38a1f1a9a64d6963e42ec7))
11
+
12
+ ### [0.10.8](https://github.com/beauraines/toggl-cli/compare/v0.10.7...v0.10.8) (2023-03-13)
13
+
14
+
15
+ ### Features
16
+
17
+ * **today report:** improves output ([0025d4a](https://github.com/beauraines/toggl-cli/commit/0025d4a4ab2f81ea31e27cd06d4ce0e69e3288f5))
18
+ * **weekly report:** improves table output format ([4e58b1a](https://github.com/beauraines/toggl-cli/commit/4e58b1a7bbf6fcdc815be44e87f7aeca44583a09))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * lintfix ([e52684c](https://github.com/beauraines/toggl-cli/commit/e52684c022a02bdf4add209fdc0a7681095a85ee))
24
+
5
25
  ### [0.10.7](https://github.com/beauraines/toggl-cli/compare/v0.10.6...v0.10.7) (2023-03-12)
6
26
 
7
27
 
package/README.md CHANGED
@@ -40,7 +40,7 @@ This was made possible because [saintedlama](https://github.com/saintedlama) had
40
40
  | Client: other user feature? | | |
41
41
  | Client: specify client name | | |
42
42
  | Colorize output | | |
43
- | Better table output | | |
43
+ | Better table output || |
44
44
  | List recent time entries | ✅ | |
45
45
  | Command line completion | ✅ | [#6](https://github.com/beauraines/toggl-cli-node/issues/6) |
46
46
 
package/cmds/today.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import Client from '../client.js'
2
2
  import dayjs from 'dayjs'
3
- import {getWorkspace,getProjects, formatDuration,formatDurationAsTime} from '../utils.js'
3
+ import { getWorkspace, getProjects, formatDuration, formatDurationAsTime } from '../utils.js'
4
4
  import dur from 'dayjs/plugin/duration.js'
5
5
  import relativeTime from 'dayjs/plugin/relativeTime.js'
6
+ import Table from 'cli-table3'
6
7
  dayjs.extend(relativeTime)
7
8
  dayjs.extend(dur)
8
9
 
@@ -14,7 +15,7 @@ export const handler = async function (argv) {
14
15
  const client = Client()
15
16
  const workspace = await getWorkspace()
16
17
  const projects = await getProjects(workspace.id)
17
- const params = {
18
+ const params = {
18
19
  start_date: dayjs().startOf('day').toISOString(),
19
20
  end_date: dayjs().toISOString()
20
21
  }
@@ -77,7 +78,13 @@ function displayDailyReport (report, format) {
77
78
  break
78
79
  case 'table':
79
80
  default:
80
- console.table(report, ['project_name', 'duration_formatted'])
81
+ const table = new Table({
82
+ head: ['Project', 'Duration']
83
+ })
84
+ for (const project of report) {
85
+ table.push([project.project_name, project.duration_formatted])
86
+ }
87
+ console.log(table.toString())
81
88
  break
82
89
  }
83
90
  }
package/cmds/weekly.mjs CHANGED
@@ -3,6 +3,7 @@ import { getWorkspace, formatDuration, getProjectById } from '../utils.js'
3
3
  import dayjs from 'dayjs'
4
4
  import dur from 'dayjs/plugin/duration.js'
5
5
  import relativeTime from 'dayjs/plugin/relativeTime.js'
6
+ import Table from 'cli-table3'
6
7
  dayjs.extend(relativeTime)
7
8
  dayjs.extend(dur)
8
9
 
@@ -54,7 +55,15 @@ export const handler = async function (argv) {
54
55
  for (const project of reportData) {
55
56
  project.Total = formatDuration(project.Total * 1000)
56
57
  }
57
- console.table(reportData)
58
+
59
+ const head = Object.keys(reportData[0])
60
+ const table = new Table({
61
+ head
62
+ })
63
+ for (const project of reportData) {
64
+ table.push(Object.values(project))
65
+ }
66
+ console.log(table.toString())
58
67
  }
59
68
 
60
69
  // TODO figure out what to do with these
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beauraines/toggl-cli",
3
- "version": "0.10.7",
3
+ "version": "0.10.9",
4
4
  "description": "",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
+ "cli-table3": "^0.6.3",
33
34
  "dayjs": "^1.11.6",
34
35
  "debug": "^4.3.4",
35
36
  "dotenv": "^16.0.3",