diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2018-09-28 12:25:28 +0200 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2018-09-28 12:25:28 +0200 |
| commit | 35bbd18bf8943a20784d676cb6153c6a826f2d93 (patch) | |
| tree | f7eea306d36402c97264d068678e1da14bef29e3 /interact.go | |
| parent | bf11a0caa0d71b253b1172bf96765f5e53f7a4d4 (diff) | |
List Projects and Tasks if no id is given to editproject/edittask
Diffstat (limited to 'interact.go')
| -rw-r--r-- | interact.go | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/interact.go b/interact.go index f4a8b4b..0c9f73b 100644 --- a/interact.go +++ b/interact.go @@ -201,7 +201,16 @@ func interact() { c.Println(boldRed(arg,"is not a valid id!")) } }else{ - c.Println(boldRed("edittask <id> - Please enter an id")) + tids := getTaskIds() + selids,lids := getTaskList(tids,false) + choice := c.MultiChoice(lids,"Select a Task to Edit") + c.Println(tids) + c.Println(selids) + if choice > -1 { + editTask(selids[choice]) + //c.Println(choice,selids[choice]) + } + //c.Println(boldRed("edittask <id> - Please enter an id")) } c.Println(promptcol("______________________")) }, @@ -226,8 +235,17 @@ func interact() { c.Println(boldRed(arg,"is not a valid id!")) } }else{ - c.Println(boldRed("editproject <id> - Please enter an id")) - allProjects() + pids := getProjectIds() + selids,lids := getProjectList(pids) + choice := c.MultiChoice(lids,"Select a Project to Edit") + c.Println(pids) + c.Println(selids) + if choice > -1 { + editProject(selids[choice]) + //c.Println(choice,selids[choice]) + } + //c.Println(boldRed("editproject <id> - Please enter an id")) + //allProjects() } c.Println(promptcol("______________________")) }, @@ -385,6 +403,17 @@ func interact() { }, }) */ + //Test stuff in shell + shell.AddCmd(&ishell.Cmd{ + Name: "test", + Help: "Test some functions in interactive mode", + LongHelp: ` Usage: test + Test functions in interactive mode`, + Func: func(c *ishell.Context) { + multichoice("Geh scheissn") + + }, + }) // Prompt Color shell.AddCmd(&ishell.Cmd{ @@ -602,4 +631,30 @@ func interact() { //fmt.Println("Laboravi emeritus...") } +func multichoice(about string) { + shell := ishell.New() + shell.SetMultiChoicePrompt(" ->"," - ") + shell.SetChecklistOptions("[ ] ","[X] ") + + shell.AddCmd(&ishell.Cmd{ + Name: "choice", + Help: "multiple choice prompt", + Func: func(c *ishell.Context) { + choice := c.MultiChoice([]string{ + "Golangers", + "Go programmers", + "Gophers", + "Goers", + }, "What are Go programmers called ?") + if choice == 2 { + c.Println("You got it!") + } else { + c.Println("Sorry, you're wrong.") + } + }, + }) + str := "choice" + shell.Process(str) + shell.Println(about) +} |
