From b5bc66a01b24b5a10c04de584c1681898308124b Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Mon, 29 Apr 2019 01:51:36 +0200 Subject: Uncheck Bills --- interact.go | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'interact.go') 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", @@ -213,6 +213,37 @@ func interact(fulldb bool) { c.Println(promptcol("______________________")) }, }) + delcmd.AddCmd(&ishell.Cmd{ + Name: "payment", + Help: " Delete the Payment with the following id", + LongHelp: ` Usage: delete payment + Delete the payment of the set `, + 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 - Please enter an id")) + //allProjects() + } + c.Println(promptcol("______________________")) + }, + }) delcmd.AddCmd(&ishell.Cmd{ Name: "task", Help: " Delete a Task with the following 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: " Open a Project of the following id", @@ -277,6 +310,8 @@ func interact(fulldb bool) { }, }) + // EDIT COMMAND + { editcmd := &ishell.Cmd{ Name: "edit", -- cgit v1.2.3