Skip to content

Commit

Permalink
add item delete command
Browse files Browse the repository at this point in the history
  • Loading branch information
kobtea committed Mar 11, 2017
1 parent f44f217 commit 9ee175a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cmd/todoist/cmd/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ var itemAddCmd = &cobra.Command{
},
}

var itemDeleteCmd = &cobra.Command{
Use: "delete",
Short: "delete items",
RunE: func(cmd *cobra.Command, args []string) error {
if err := util.AutoCommit(func(client todoist.Client, ctx context.Context) error {
return util.ProcessIDs(
args,
func(ids []todoist.ID) error {
return client.Item.Delete(ids)
})
}); err != nil {
return err
}
fmt.Println("Successful deleting of item(s).")
return nil
},
}

var itemCompleteCmd = &cobra.Command{
Use: "complete",
Short: "complete items",
Expand Down Expand Up @@ -109,6 +127,7 @@ func init() {
RootCmd.AddCommand(itemCmd)
itemCmd.AddCommand(itemListCmd)
itemCmd.AddCommand(itemAddCmd)
itemCmd.AddCommand(itemDeleteCmd)
itemCmd.AddCommand(itemCompleteCmd)
itemCmd.AddCommand(itemUncompleteCmd)
}

0 comments on commit 9ee175a

Please sign in to comment.