@beauraines/toggl-cli 0.10.6 → 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,5 +12,6 @@
12
12
  "sourceType": "module"
13
13
  },
14
14
  "rules": {
15
+ "no-unused-expressions": "warn"
15
16
  }
16
17
  }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,38 @@
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
+
25
+ ### [0.10.7](https://github.com/beauraines/toggl-cli/compare/v0.10.6...v0.10.7) (2023-03-12)
26
+
27
+
28
+ ### Features
29
+
30
+ * updates app name sent with API requests ([9cf9a2b](https://github.com/beauraines/toggl-cli/commit/9cf9a2b4f6c1e638e2e3d8e251d0f15469627181))
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * can edit time entries ([36cd1aa](https://github.com/beauraines/toggl-cli/commit/36cd1aa7519becda6abddee0e4e3fad37730822e))
36
+
5
37
  ### [0.10.6](https://github.com/beauraines/toggl-cli/compare/v0.10.5...v0.10.6) (2023-03-12)
6
38
 
7
39
 
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
@@ -9,13 +9,14 @@ dayjs.extend(timezone)
9
9
 
10
10
  export const command = 'edit'
11
11
  // FIXME editing not working
12
- export const desc = 'SOMETHING IS NOT RIGHT Edits the current running time entry'
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'.`
13
14
 
14
15
  export const builder = {
15
16
  d: { alias: ['description'], describe: 'Time entry name', type: 'string:' },
16
17
  p: { alias: ['projectId', 'project'], describe: 'The case insensitive project name or project id.', type: 'string', demandOption: false },
17
- s: { alias: ['start', 'startTime'], describe: 'The case insensitive project name or project id.', type: 'string', demandOption: false },
18
- e: { alias: ['end', 'endTime'], describe: 'The case insensitive project name or project id.', type: 'string', demandOption: false }
18
+ s: { alias: ['start', 'startTime'], describe: 'The start time for the task, e.g. 13:00 12:45AM.', type: 'string', demandOption: false },
19
+ e: { alias: ['end', 'endTime'], describe: 'The end time for the task, e.g. 13:00 12:45AM.', type: 'string', demandOption: false }
19
20
  }
20
21
 
21
22
  export const handler = async function (argv) {
@@ -59,8 +60,8 @@ export const handler = async function (argv) {
59
60
  project ? params.project_id = +project.id : undefined
60
61
  startTime ? params.start = startTime.toISOString() : undefined
61
62
  endTime ? params.stop = endTime.toISOString() : undefined
62
- endTime ? params.duration = endTime.diff(startTime, 'seconds') : undefined
63
63
  argv.description ? params.description = argv.description : undefined
64
+ debug(params)
64
65
  const timeEntry = await client.timeEntries.update(currentTimeEntry.id, params)
65
66
  await displayTimeEntry(timeEntry)
66
67
  }
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.6",
3
+ "version": "0.10.9",
4
4
  "description": "",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -30,7 +30,9 @@
30
30
  },
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
+ "cli-table3": "^0.6.3",
33
34
  "dayjs": "^1.11.6",
35
+ "debug": "^4.3.4",
34
36
  "dotenv": "^16.0.3",
35
37
  "open": "^8.4.0",
36
38
  "toggl-client": "^3.1.1",
package/utils.js CHANGED
@@ -93,7 +93,7 @@ export const convertUtcTime = function (dateTime) {
93
93
  return dayjs(dateTime).tz(tz).format('YYYY-MM-DD HH:mm')
94
94
  }
95
95
 
96
- export const appName = 'toggl-cli-node'
96
+ export const appName = '@beauraines/toggl-cli'
97
97
 
98
98
  /**
99
99
  * Displays a time entry on the console