Skip to content

Commit

Permalink
feat: Remove time entry by id (#160)
Browse files Browse the repository at this point in the history
Adds `rm` command 
  toggl rm <id>                 Remove a time entry by id

Contributed by @benthayer
  • Loading branch information
benthayer committed May 15, 2024
1 parent c5ab138 commit de37a85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmds/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as edit from './edit.mjs'
import * as web from './web.mjs'
import * as startTimeEntry from './startTimeEntry.mjs'
import * as stopTimeEntry from './stopTimeEntry.mjs'
import * as removeTimeEntry from './removeTimeEntry.mjs'
import * as today from './today.mjs'
import * as weekly from './weekly.mjs'
import * as createConfig from './create-config.mjs'
Expand All @@ -20,6 +21,7 @@ export const commands = [
projects,
startTimeEntry,
stopTimeEntry,
removeTimeEntry,
today,
web,
weekly,
Expand Down
12 changes: 12 additions & 0 deletions cmds/removeTimeEntry.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Client from '../client.js'
import dayjs from 'dayjs'

export const command = 'rm <id>'
export const desc = 'Remove a time entry by id'
export const builder = {}

export const handler = async function (argv) {
const client = await Client()
const deleted = await client.timeEntries.delete(argv.id)
console.log(`Deleted time entry with id #${argv.id}`)
}

0 comments on commit de37a85

Please sign in to comment.