summaryrefslogtreecommitdiff
path: root/interact.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2018-10-26 01:23:24 +0200
committerNikolaus Gotsche <n@softwarefools.com>2018-10-26 01:23:24 +0200
commit1312d9dc80d3c43fce59e41ca3798abafd67e5f3 (patch)
treee5a0b075c7cf41f3dd9235009dd3202cd61f39bd /interact.go
parent25e12980c0448cb58e545fffa137905fd861dea3 (diff)
Colorprompt saved
Diffstat (limited to 'interact.go')
-rw-r--r--interact.go59
1 files changed, 36 insertions, 23 deletions
diff --git a/interact.go b/interact.go
index 7336550..51b9e94 100644
--- a/interact.go
+++ b/interact.go
@@ -12,6 +12,8 @@ import (
"github.com/fatih/color"
)
+//var mastercol *color.Color
+
func interact() {
//stdOut()
shell := ishell.New()
@@ -29,7 +31,8 @@ func interact() {
boldGreen := color.New(color.FgGreen, color.Bold).SprintFunc()
boldYell := color.New(color.FgYellow, color.Bold).SprintFunc()
- promptcol := boldBlue
+ //PromptColor(GetColor())
+ promptcol := PromptColor(GetColor()).SprintFunc()
// display info.
//shell.Println("Starting interactive Shell")
@@ -499,7 +502,9 @@ func interact() {
nm,st := GetTaskSums(currproject.id)
i := Multichoice("Sicha?",st)
fmt.Println(nm[i])
-
+ //some := []string{"Nice","Shit this","is. Truly","Man"}
+ //out := getInterAutoInput("Got milk?",some)
+ //fmt.Println(out)
},
})
@@ -518,26 +523,10 @@ func interact() {
boldYell("Yellow"),
boldRed("Red"),
}, "What Color should the Prompt be?")
- switch choice {
- case 0:
- c.SetPrompt(boldMag(">>>"))
- promptcol = boldMag
- case 1:
- c.SetPrompt(boldBlue(">>>"))
- promptcol = boldBlue
- case 2:
- c.SetPrompt(boldCyan(">>>"))
- promptcol = boldCyan
- case 3:
- c.SetPrompt(boldGreen(">>>"))
- promptcol = boldGreen
- case 4:
- c.SetPrompt(boldYell(">>>"))
- promptcol = boldYell
- case 5:
- c.SetPrompt(boldRed(">>>"))
- promptcol = boldRed
- }
+ promptcol = PromptColor(choice).SprintFunc()
+ //promptcol = mastercol.SprintFunc()
+
+ c.SetPrompt(promptcol(">>>"))
c.Println(promptcol("As You Wish!"))
c.Println(promptcol("______________________"))
@@ -735,6 +724,30 @@ func isInterSure(question string) bool {
}
}
+/*
+func getInterAutoInput(question string,autocom []string) (out string) {
+ shell := ishell.New()
+ shell.ShowPrompt(false)
+ defer shell.ShowPrompt(true)
+ shell.AddCmd(&ishell.Cmd{
+ Name: "fun",
+ Help: "never to be seen",
+ Completer: func([]string) []string {
+ return autocom
+ },
+ Func: func(c *ishell.Context) {
+
+ shell.Print(question)
+ //out = shell.ReadLine()
+ out = fmt.Sprint(c.Args)
+ },
+ })
+
+ //shell.SetRootCmd("fun")
+ shell.Run()
+ return
+}*/
+
func getInterInput(question string) (out string) {
shell := ishell.New()
shell.ShowPrompt(false)
@@ -815,7 +828,7 @@ func getNewInterMultiInput(question, old, border string) (out string) {
func Multichoice(question string,list []string) (int) {
shell := ishell.New()
- shell.SetMultiChoicePrompt(" ->", " - ")
+ shell.SetMultiChoicePrompt(" ->"," - ")
shell.SetChecklistOptions("[ ] ", "[X] ")
choice := shell.MultiChoice(list,question)