Skip to content

Commit

Permalink
support due option at item add
Browse files Browse the repository at this point in the history
  • Loading branch information
kobtea committed Sep 12, 2018
1 parent 60cc0d2 commit cf685fc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/todoist/cmd/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ var itemAddCmd = &cobra.Command{
}
}

due, err := cmd.Flags().GetString("due")
if err != nil {
return errors.New("invalid due date format")
}
if len(due) > 0 {
item.DateString = due
}

priority, err := cmd.Flags().GetInt("priority")
if err != nil {
return errors.New("invalid priority")
Expand Down Expand Up @@ -206,7 +214,7 @@ func init() {
itemCmd.AddCommand(itemListCmd)
itemAddCmd.Flags().StringP("project", "p", "inbox", "project name")
itemAddCmd.Flags().StringP("label", "l", "", "label name(s) (delimiter: ,)")
// itemAddCmd.Flags().StringP("due", "d", "", "due date")
itemAddCmd.Flags().StringP("due", "d", "", "due date")
itemAddCmd.Flags().Int("priority", 1, "priority")
itemCmd.AddCommand(itemAddCmd)
itemCmd.AddCommand(itemDeleteCmd)
Expand Down

0 comments on commit cf685fc

Please sign in to comment.