Skip to content

Commit

Permalink
entries: implemented delete
Browse files Browse the repository at this point in the history
  • Loading branch information
phiros committed Apr 3, 2019
1 parent dfae81a commit ee67849
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions cmd/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ import (
)

var (
listTo string
listFrom string
listOrder string
createDate string
createDuration time.Duration
createNote string
createProjectId string
createServiceId string
editTimeEntryId string
editDate string
editDuration string
editNote string
editProjectId string
editServiceId string
listTo string
listFrom string
listOrder string
createDate string
createDuration time.Duration
createNote string
createProjectId string
createServiceId string
editTimeEntryId string
editDate string
editDuration string
editNote string
editProjectId string
editServiceId string
deleteTimeEntryId string
)

func init() {
Expand Down Expand Up @@ -55,6 +56,9 @@ func init() {
entriesEditCommand.Flags().StringVarP(&editProjectId, "projectid", "p", "", "project id for time entry (HINT: use the 'project' sub-command to find the id)")
entriesEditCommand.Flags().StringVarP(&editServiceId, "serviceid", "s", "", "service id for time entry (HINT: use the 'service' sub-command to find the id)")
entriesCommand.AddCommand(entriesEditCommand)
// delete
entriesDeleteCommand.Flags().StringVarP(&deleteTimeEntryId, "id", "i", "", "the time entry id to delete")
entriesCommand.AddCommand(entriesDeleteCommand)
rootCmd.AddCommand(entriesCommand)
}

Expand Down Expand Up @@ -206,3 +210,11 @@ var entriesEditCommand = &cobra.Command{
return nil
},
}

var entriesDeleteCommand = &cobra.Command{
Use: "delete",
Short: "deletes a time entry",
RunE: func(cmd *cobra.Command, args []string) error {
return deps.miteApi.DeleteTimeEntry(deleteTimeEntryId)
},
}

0 comments on commit ee67849

Please sign in to comment.