From ba96c6fae2ca3ea3399934ffd010cecfbaec273c Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Tue, 2 Oct 2018 01:48:53 +0200 Subject: New Input method --- interact.go | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'interact.go') diff --git a/interact.go b/interact.go index 0c9f73b..932ce1d 100644 --- a/interact.go +++ b/interact.go @@ -128,7 +128,7 @@ func interact() { c.Println(boldRed(arg,"is not a valid id!")) } }else{ - c.Println(boldRed("deletetask - Please enter an id")) + c.Println(boldRed("deletebill - Please enter an id")) showLastBills(0) } c.Println(promptcol("______________________")) @@ -152,8 +152,14 @@ func interact() { c.Println(boldRed(arg,"is not a valid id!")) } }else{ - c.Println(boldRed("deletetask - Please enter an id")) - allProjects() + tids := getTaskIds() + selids,lids := getTaskList(tids,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("______________________")) }, @@ -177,8 +183,15 @@ func interact() { c.Println(boldRed(arg,"is not a valid id!")) } }else{ - c.Println(boldRed("project - Please enter an id")) - allProjects() + pids := getProjectIds() + selids,lids := getProjectList(pids) + choice := c.MultiChoice(lids,"Select a Project to Edit") + if choice > -1 { + setProject(selids[choice]) + } + //c.Println(boldRed("editproject - Please enter an id")) + //c.Println(boldRed("project - Please enter an id")) + //allProjects() } c.Println(promptcol("______________________")) }, @@ -204,8 +217,8 @@ func interact() { tids := getTaskIds() selids,lids := getTaskList(tids,false) choice := c.MultiChoice(lids,"Select a Task to Edit") - c.Println(tids) - c.Println(selids) + //c.Println(tids) + //c.Println(selids) if choice > -1 { editTask(selids[choice]) //c.Println(choice,selids[choice]) @@ -229,7 +242,7 @@ func interact() { argi,err := strconv.Atoi(arg) if err == nil{ editProject(argi) - allProjects() + //allProjects() //stdOut() }else{ c.Println(boldRed(arg,"is not a valid id!")) @@ -238,8 +251,8 @@ func interact() { pids := getProjectIds() selids,lids := getProjectList(pids) choice := c.MultiChoice(lids,"Select a Project to Edit") - c.Println(pids) - c.Println(selids) + //c.Println(pids) + //c.Println(selids) if choice > -1 { editProject(selids[choice]) //c.Println(choice,selids[choice]) @@ -631,6 +644,21 @@ func interact() { //fmt.Println("Laboravi emeritus...") } + + +func getInterInput(question string) (out string) { + shell := ishell.New() + //shell.SetMultiChoicePrompt(" ->"," - ") + //shell.SetChecklistOptions("[ ] ","[X] ") + shell.ShowPrompt(false) + defer shell.ShowPrompt(true) + + shell.Print(question) + out = shell.ReadLine() + + return +} + func multichoice(about string) { shell := ishell.New() -- cgit v1.2.3