@beauraines/toggl-cli 0.10.7 → 0.10.10

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,33 @@
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.10](https://github.com/beauraines/toggl-cli/compare/v0.10.9...v0.10.10) (2023-03-16)
6
+
7
+
8
+ ### Features
9
+
10
+ * edit command is throwing an error ([#50](https://github.com/beauraines/toggl-cli/issues/50)) ([794feab](https://github.com/beauraines/toggl-cli/commit/794feab35dae4eb8b79ec4ae1749024bb4f05c72)), closes [#49](https://github.com/beauraines/toggl-cli/issues/49)
11
+
12
+ ### [0.10.9](https://github.com/beauraines/toggl-cli/compare/v0.10.7...v0.10.9) (2023-03-13)
13
+
14
+
15
+ ### Features
16
+
17
+ * improves report table output ([#46](https://github.com/beauraines/toggl-cli/issues/46)) ([4e90a80](https://github.com/beauraines/toggl-cli/commit/4e90a80a2d9c4e3e0a38a1f1a9a64d6963e42ec7))
18
+
19
+ ### [0.10.8](https://github.com/beauraines/toggl-cli/compare/v0.10.7...v0.10.8) (2023-03-13)
20
+
21
+
22
+ ### Features
23
+
24
+ * **today report:** improves output ([0025d4a](https://github.com/beauraines/toggl-cli/commit/0025d4a4ab2f81ea31e27cd06d4ce0e69e3288f5))
25
+ * **weekly report:** improves table output format ([4e58b1a](https://github.com/beauraines/toggl-cli/commit/4e58b1a7bbf6fcdc815be44e87f7aeca44583a09))
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * lintfix ([e52684c](https://github.com/beauraines/toggl-cli/commit/e52684c022a02bdf4add209fdc0a7681095a85ee))
31
+
5
32
  ### [0.10.7](https://github.com/beauraines/toggl-cli/compare/v0.10.6...v0.10.7) (2023-03-12)
6
33
 
7
34
 
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/edit.mjs CHANGED
@@ -1,16 +1,19 @@
1
+ /* eslint-disable no-unused-expressions */
1
2
  import Client from '../client.js'
2
3
  import { defaultWorkspaceId, getProjectByName, getProjectById, appName, displayTimeEntry } from '../utils.js'
3
4
  import dayjs from 'dayjs'
5
+ import debugClient from 'debug'
4
6
  import utc from 'dayjs/plugin/utc.js'
5
7
  import timezone from 'dayjs/plugin/timezone.js'
6
8
  import yargs from 'yargs'
7
9
  dayjs.extend(utc)
8
10
  dayjs.extend(timezone)
9
11
 
12
+ const debug = debugClient('rtm-cli-edit');
13
+
10
14
  export const command = 'edit'
11
15
  // FIXME editing not working
12
- export const desc = `Edits the current running time entry. Only updating the time is supported `+
13
- `and the time must be parsable by dayjs, e.g. 4:50PM or '12:00 AM'.`
16
+ export const desc = 'Edits the current running time entry. Only updating the time is supported and the time must be parsable by dayjs, e.g. 4:50PM or \'12:00 AM\'.'
14
17
 
15
18
  export const builder = {
16
19
  d: { alias: ['description'], describe: 'Time entry name', type: 'string:' },
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.10",
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",