Code Monkey home page Code Monkey logo

toggl-cli's People

Contributors

beauraines avatar dependabot[bot] avatar github-actions[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

toggl-cli's Issues

Reports throw an error when there are time entries without a description

If you have an undefined time entry, like one started without a description through the mobile app as shown with toggl-node ls

│   40    │          undefined           │ '2022-06-07 05:55' │ '2022-06-07 06:04' │ '0h 8m'  │
│   41    │       'no description'       │ '2022-06-07 08:23' │ '2022-06-07 08:58' │ '0h 34m' │

when running the report it will throw an error

$ toggl-node today
toggl-node today

Reports today's activities by project

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

TypeError: Cannot read properties of undefined (reading 'name')
    at /Users/beauraines/projects/toggl-cli-node/cmds/today.js:42:35
    at Array.map (<anonymous>)
    at Object.exports.handler (/Users/beauraines/projects/toggl-cli-node/cmds/today.js:28:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

These should be grouped with their project, or no project, were applicable.

Add weekly report options

As a user, I want to be able to get a weekly report for prior weeks, so I can see last week's summary.

Still cannot edit time entries

I left a time entry running overnight and tried to edit the stop date to a date on the prior day. I wasn't able to do that because I got some date formatting errors and some payload errors from the API.

Problems parsing the string

toggl edit --end '2023-03-06T18:31'
toggl edit --end '2023-03-06 18:31'

TypeError: endTime.toISOString is not a function

This looks like the payload was insufficient

toggl edit --end '18:31'

Error: Toggl API responded with status code 400. Response: "Stop and duration mismatch"

I'm guessing I'm not submitting sufficient information in the edit request.

Also the description of the edit command still says "SOMETHING IS NOT RIGHT"

Overlap detection

Add overlap detection to the edit command. Maybe first iteration is to just alert that it overlaps, second is automatic editing of earlier entry.

When I edit a time entry, make a warning if it overlaps an existing entry.

ls command doesn't properly display current running event

When you run the ls command, it outputs negative time for the current running event.

25 │ 'xxxx' │ '2022-05-23 05:58' │ '2022-05-23 06:58' │ '-132h -58m'

It should display some indicator that the time entry is running and possibly the current duration. The python version displays it like this.

 Description            Duration                  Start                    Stop
 Axon                    1:00:48  5:58:46 AM 05/23/2022                 running

Additionally, the output should

  1. be in reverse chronological order.
  2. include the project

Enhance ls command

  • include project in the display
  • upgrade to cli-table3 output
  • fix the running time entry
  • sort oldest to newest
  • add ability to only display strings
  • see if it makes sense to add date range options

Cannot edit time entries

When you try to edit a time entry, even when a time entry is running the CLI returns 'no current time entry'

Off hand, I'm not seeing where that is coming from!

Add options for web command

As a user, I want to be able to select what web page opens with the web command, so that I can go directly to the part of the Toggl site with no extra clicks.

  • reports
  • timer

fix duration and date display in current running entries

When running toggl now the duration and stop time are populated but not exactly right.

$ toggl now
#33 Update time-entries module for remaining v9 API changes #2911783204
Billable: false
Duration: 0h 0m
Project: Side Projects (#4599739)
Start: 2023-04-01 09:55
Stop: Invalid Date

I think that the duration is coming from what the API returns and its a fixed value, so if it comes back zero it should be calculated.

I think that the date conversion function is returning Invalid Date because its trying to convert null.

I think that this should be handled in the display functions.

ls command with search term should be case insensitive

AIM-841MD6R:toggl-cli beauraines$ toggl ls thought
┌─────────────┬─────────┬───────┬──────┬──────────┬───────────────┐
│ Description │ Project │ Start │ Stop │ Duration │ Time Entry ID │
└─────────────┴─────────┴───────┴──────┴──────────┴───────────────┘
AIM-841MD6R:toggl-cli beauraines$ toggl ls Thought
┌────────────────────────────┬─────────┬──────────────────┬──────────────────┬──────────┬───────────────┐
│ Description                │ Project │ Start            │ Stop             │ Duration │ Time Entry ID │
├────────────────────────────┼─────────┼──────────────────┼──────────────────┼──────────┼───────────────┤
│ Thought Leadership article │ Worked  │ 2023-06-29 16:32 │ 2023-06-29 17:15 │ 0h 42m   │ x             │
└────────────────────────────┴─────────┴──────────────────┴──────────────────┴──────────┴───────────────┘

edit command is throwing an error

When using the edit command, it is returning an error

$ toggl edit --start 11:48AM

dumps

ReferenceError: debug is not defined
    at Object.handler (file:///Users/beauraines/.nvm/versions/node/v16.18.0/lib/node_modules/@beauraines/toggl-cli/cmds/edit.mjs:64:3)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Seems like the debug import/instantiation got missed.

Continue command with no match starts undefined project

When using continue no task should be started if no match is found. In the example below it should have returned an error message like (but not exactly) You don't have any time entries in past 9 days! rather than starting no description

$ toggl-node continue status
Continued no description for project undefined
$ toggl-node now
no description #xxxxx
Billable: false
Duration: 0h 0m
Project: undefined (#undefined)
Start: 2022-05-19 13:57
Stop:
Workspace: beau.raines's workspace (#xxxx)

Options to start not being parsed properly

toggl-cli-node beauraines$ ./cli.js start All Hands Meeting
{"_":["start","Meeting"],"$0":"toggl","options":"All","description":"Hands"}
{ description: 'Hands', workspaceId: xxxx, projectId: xxxx }

Today report errors if there is entry with no name

I was running an timer that had no name e.g. undefined #2563211804 and then tried to run the today report. It errored with the following message

TypeError: Cannot read properties of undefined (reading 'name')
    at /Users/beauraines/projects/toggl-cli-node/cmds/today.js:42:35
    at Array.map (<anonymous>)
    at Object.exports.handler (/Users/beauraines/projects/toggl-cli-node/cmds/today.js:28:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Improve error output

If a user enters a command in error, e.g. continute rather than continue, the toggl command silently exits. This has resulted in me not starting a time entry as expected. As a toggl user, I want to be alerted if I entery a command in error, so I know that I should fix it.

Check out the [.fail()](https://github.com/yargs/yargs/blob/main/docs/api.md#failfn--boolean) API method

Weekly report does not include time entries without a project

There should be some time logged on Saturday 9 July

toggl-node ls

│   38    │     'no description'     │ '2022-07-09 13:43' │ '2022-07-09 13:53' │ '0h 9m'  │
└─────────┴──────────────────────────┴────────────────────┴────────────────────┴──────────┘
beauraines@penguin:~/projects/toggl-cli-node$ toggl-node week
┌─────────┬─────────────┬───────────┬───────────┬───────────┬───────────┬───────────┬───────────┬───────────┬───────────┬───────────┐
│ (index) │ projectName │ projectId │ Sun 07-03 │ Mon 07-04 │ Tue 07-05 │ Wed 07-06 │ Thu 07-07 │ Fri 07-08 │ Sat 07-09 │   Total   │
├─────────┼─────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│    0    │   'Project 1'    │ 181439722 │  '0h 0m'  │  '0h 0m'  │ '8h 28m'  │ '7h 49m'  │  '8h 9m'  │  '7h 9m'  │  '0h 0m'  │ '31h 36m' │
│    1    │  'Project 2'   │ 174558624 │  '0h 0m'  │  '0h 0m'  │ '0h 52m'  │ '0h 33m'  │ '0h 11m'  │ '1h 24m'  │  '0h 0m'  │  '3h 2m'  │
│    2    │   'Total'   │    ''     │  '0h 0m'  │  '0h 0m'  │ '9h 20m'  │ '8h 22m'  │ '8h 21m'  │ '8h 34m'  │  '0h 0m'  │ '34h 38m' │
└─────────┴─────────────┴───────────┴───────────┴───────────┴───────────┴───────────┴───────────┴───────────┴───────────┴───────────┘

Cannot start new time entry

Tried to start new entry toggl start XXXXX and got the following error. I expected a new time entry to be created

Error: Toggl API responded with status code 400. Response: "Unexpected \"workspace_id\" type string, offset=88"
    at TogglClient.request (file:///Users/beauraines/.nvm/versions/node/v16.18.0/lib/node_modules/toggl-cli-node/node_modules/toggl-client/lib/client.js:90:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async TogglClient.post (file:///Users/beauraines/.nvm/versions/node/v16.18.0/lib/node_modules/toggl-cli-node/node_modules/toggl-client/lib/client.js:71:12)
    at async TimeEntries.create (file:///Users/beauraines/.nvm/versions/node/v16.18.0/lib/node_modules/toggl-cli-node/node_modules/toggl-client/lib/time-entries.js:38:12)
    at async createTimeEntry (file:///Users/beauraines/.nvm/versions/node/v16.18.0/lib/node_modules/toggl-cli-node/utils.js:44:21)
    at async Object.handler (file:///Users/beauraines/.nvm/versions/node/v16.18.0/lib/node_modules/toggl-cli-node/cmds/startTimeEntry.mjs:36:21)

Error with weekly report

when running toggl week I get the following error message

TypeError: Cannot read properties of undefined (reading 'name')
    at Object.handler (file:///Users/beauraines/.nvm/versions/node/v16.18.0/lib/node_modules/@beauraines/toggl-cli/cmds/weekly.mjs:28:35)

I expect to get the weekly report in a table format.

Add command line completion

diff --git a/cli.js b/cli.js
index 8184280..88e5352 100755
--- a/cli.js
+++ b/cli.js
@@ -8,6 +8,7 @@ const yargs = require("yargs");
 require('yargs/yargs')(process.argv.slice(2))
   .scriptName('toggl')
   .commandDir('cmds')
+  .completion('completion','Outputs bash/zsh-completion shortcuts for commands and options to add to .bashrc or .bash_profile')
   .demandCommand()
   .help()
   .argv

Add option to limit number of entries returned with ls

Add an option to limit the number of entries returned with the ls command

This is similar to AuHau/toggl-cli#313

Note that the GET time_entries endpoint only allows a date range filter, so this new --limit command would have to be viewed as only returning the last N entries in the requested (defaults to 14) days.

Include the currently running event in the week command

The week command is based upon the Reports API, which only excludes the currently running activity. It would be nice if the output also included the currently running activity, for an up to the minute view of a week.

Maybe this is controlled with some option, Reports API only or Reports + current

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.