diff options
Diffstat (limited to 'interact.go')
| -rw-r--r-- | interact.go | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/interact.go b/interact.go index 4aae3ac..e3135d3 100644 --- a/interact.go +++ b/interact.go @@ -183,7 +183,7 @@ func interact(fulldb bool) { }) */ - // Delete Commands: Bill / Task + // Delete Commands: Bill / Task / Payment { delcmd := &ishell.Cmd{ Name: "delete", @@ -214,6 +214,37 @@ func interact(fulldb bool) { }, }) delcmd.AddCmd(&ishell.Cmd{ + Name: "payment", + Help: "<id> Delete the Payment with the following id", + LongHelp: ` Usage: delete payment <id> + Delete the payment of the set <id>`, + Func: func(c *ishell.Context) { + arg := "none" + if len(c.Args) > 0 { + arg = strings.Join(c.Args, " ") + argi, err := strconv.Atoi(arg) + if err == nil { + DeletePayment(argi) + stdOut() + } else { + c.Println(boldRed(arg, " is not a valid id!")) + } + } else { + /* + tids := GetTaskIds() + selids, lids := GetPaymentList(tids, false,false) + choice := c.MultiChoice(lids, "Select a Task to Edit") + if choice > -1 { + deleteTask(selids[choice]) + } + */ + //c.Println(boldRed("deletetask <id> - Please enter an id")) + //allProjects() + } + c.Println(promptcol("______________________")) + }, + }) + delcmd.AddCmd(&ishell.Cmd{ Name: "task", Help: "<id> Delete a Task with the following id", LongHelp: ` Usage: delete task <id> @@ -227,12 +258,12 @@ func interact(fulldb bool) { deleteTask(argi) stdOut() } else { - c.Println(boldRed(arg, "is not a valid id!")) + c.Println(boldRed(arg, " is not a valid id!")) } } else { tids := GetTaskIds() selids, lids := GetTaskList(tids, false,false) - choice := c.MultiChoice(lids, "Select a Task to Edit") + choice := c.MultiChoice(lids, "Select a Task to Delete") if choice > -1 { deleteTask(selids[choice]) } @@ -245,6 +276,8 @@ func interact(fulldb bool) { shell.AddCmd(delcmd) } + // OPEN PROJECT COMMAND + shell.AddCmd(&ishell.Cmd{ Name: "project", Help: "<id> Open a Project of the following id", @@ -277,6 +310,8 @@ func interact(fulldb bool) { }, }) + // EDIT COMMAND + { editcmd := &ishell.Cmd{ Name: "edit", |
