diff options
| -rw-r--r-- | interact.go | 88 |
1 files changed, 67 insertions, 21 deletions
diff --git a/interact.go b/interact.go index fd6c576..6ed06c6 100644 --- a/interact.go +++ b/interact.go @@ -23,9 +23,16 @@ func interact() { boldBlue := color.New(color.FgBlue, color.Bold).SprintFunc() boldRed := color.New(color.FgRed, color.Bold).SprintFunc() + boldMag := color.New(color.FgMagenta, color.Bold).SprintFunc() + boldCyan := color.New(color.FgCyan, color.Bold).SprintFunc() + boldGreen := color.New(color.FgGreen, color.Bold).SprintFunc() + boldYell := color.New(color.FgYellow, color.Bold).SprintFunc() + + promptcol := boldBlue + // display info. shell.Println("Starting interactive Shell") - shell.SetPrompt(boldBlue(">>>")) + shell.SetPrompt(promptcol(">>>")) shell.AddCmd(&ishell.Cmd{ Name: "new", @@ -36,7 +43,7 @@ func interact() { //c.Println(boldGreen("Start New Project")) newProject() showLastProject() - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -48,7 +55,7 @@ func interact() { //c.Print("\033[H\033[2J") //c.Println(boldGreen("Start New Project")) editConf() - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -59,7 +66,7 @@ func interact() { //c.Print("\033[H\033[2J") //c.Println(boldGreen("Start New Project")) stdOut() - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -70,7 +77,7 @@ func interact() { //c.Print("\033[H\033[2J") //c.Println(boldGreen("Start New Project")) addCustomer() - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -81,7 +88,7 @@ func interact() { //c.Println(boldGreen("New Task")) newTask(currproject.id) stdOut() - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -93,7 +100,7 @@ func interact() { //c.Println(boldGreen("Stoping Task",opentask.id)) closeTask() stdOut() - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -117,7 +124,7 @@ func interact() { c.Println(boldRed("deletetask <id> - Please enter an id")) showLastBills(0) } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -141,7 +148,7 @@ func interact() { c.Println(boldRed("deletetask <id> - Please enter an id")) allProjects() } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -165,7 +172,7 @@ func interact() { c.Println(boldRed("project <id> - Please enter an id")) allProjects() } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -188,7 +195,7 @@ func interact() { }else{ c.Println(boldRed("edittask <id> - Please enter an id")) } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -212,7 +219,7 @@ func interact() { c.Println(boldRed("editproject <id> - Please enter an id")) allProjects() } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -237,7 +244,7 @@ func interact() { c.Println(boldRed("editcustomer <id> - Please enter an id")) allCustomers() } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -255,7 +262,7 @@ func interact() { }else{ c.Println(boldRed("start <DateTime> - Please enter a Datetime")) } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -273,7 +280,7 @@ func interact() { }else{ c.Println(boldRed("stop <DateTime> - Please enter a Datetime")) } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -287,7 +294,7 @@ func interact() { //c.Println(boldBlue(">> All Projects\n")) allProjects() stdOut() - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -299,7 +306,7 @@ func interact() { //c.Println(boldGreen("Start New Project")) //c.Println(boldBlue(">> All Bills\n")) showLastBills(0) - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) @@ -323,7 +330,7 @@ func interact() { //c.Print("\033[H\033[2J") //c.Println(boldGreen("Start New Project")) //stdOut() - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) }, }) /* @@ -376,6 +383,45 @@ func interact() { }, }) */ + + // Prompt Color + shell.AddCmd(&ishell.Cmd{ + Name: "colorprompt", + Help: "Select the Color of the prompt", + Func: func(c *ishell.Context) { + choice := c.MultiChoice([]string{ + boldMag("Magenta"), + boldBlue("Blue"), + boldCyan("Cyan"), + boldGreen("Green"), + 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 + } + c.Println(promptcol("As You Wish!")) + + c.Println(promptcol("______________________")) + }, + }) // Gather Tasks For Bills shell.AddCmd(&ishell.Cmd{ Name: "bill", @@ -405,7 +451,7 @@ func interact() { billprojid := 0 if multicust { - c.Println("Cannot Write One Bill to multiple Customers! Please Select different Tasks") + c.Println(boldRed("Cannot Write One Bill to multiple Customers! Please Select different Tasks")) }else{ // CHECK IF ONLY ONE PROJECT ELSE CHOOSE ONE @@ -423,7 +469,7 @@ func interact() { //c.Printf("%v Tasks Selected. Totaling %.2f (h) - Dates: %s\n",count,hours,dur) proj,cust := getProject(billprojid) if cust.id == 0 { - c.Println(boldRed("Customer ",cust.name," Cannot be billed. Please move ",proj.name," to a valid Customer")) + c.Println(boldRed("Customer ",cust.company," with id ",cust.id," Cannot be billed. Please move ",proj.name," to a valid Customer")) return } @@ -514,7 +560,7 @@ func interact() { c.ReadLine() stdOut() } - c.Println(boldBlue("______________________")) + c.Println(promptcol("______________________")) c.ShowPrompt(true) }, }) |
