diff options
| -rw-r--r-- | interact.go | 767 |
1 files changed, 423 insertions, 344 deletions
diff --git a/interact.go b/interact.go index 28c61a0..c824627 100644 --- a/interact.go +++ b/interact.go @@ -7,8 +7,8 @@ import ( "strings" "time" - //"github.com/abiosoft/ishell" - "github.com/EPRparadox82/ishell" + "github.com/abiosoft/ishell" + //"github.com/EPRparadox82/ishell" "github.com/fatih/color" ) @@ -40,34 +40,41 @@ func interact(fulldb bool) { //shell.Println("Starting interactive Shell") shell.SetPrompt(promptcol(">>>")) - shell.AddCmd(&ishell.Cmd{ - Name: "new", - Help: "Start new Project", - LongHelp: ` Usage: new + // New Customer / New Project + { + newcmd := &ishell.Cmd{ + Name: "new", + Help: "project / customer", + LongHelp: ` Usage: new <command>`, + } + newcmd.AddCmd(&ishell.Cmd{ + Name: "project", + Help: "Start new Project", + LongHelp: ` Usage: new project If no Task is currently running a new project will be added to database and opened. When there is an open Task the user will be notified to stop it before adding a new Project`, - Func: func(c *ishell.Context) { - //c.Print("\033[H\033[2J") - //c.Println(boldGreen("Start New Project")) - newProject() - //showLastProject() - stdOut() - c.Println(promptcol("______________________")) - }, - }) + Func: func(c *ishell.Context) { + //c.Print("\033[H\033[2J") + //c.Println(boldGreen("Start New Project")) + newProject() + //showLastProject() + stdOut() + c.Println(promptcol("______________________")) + }, + }) + newcmd.AddCmd(&ishell.Cmd{ + Name: "customer", + Help: "Add new Customer", + LongHelp: ` Usage: new customer + Add a new Customer to Database`, + Func: func(c *ishell.Context) { + addCustomer() + c.Println(promptcol("______________________")) + }, + }) + shell.AddCmd(newcmd) + } - shell.AddCmd(&ishell.Cmd{ - Name: "config", - Help: "View and Edit Configuration", - LongHelp: ` Usage: config - Show the current configuration and ask if it should be edited. - Configurations contains the location of the database file and the Personal Data needed for billing - If config is edited press <Enter> on empty line to keep the old entry`, - Func: func(c *ishell.Context) { - editConf() - c.Println(promptcol("______________________")) - }, - }) shell.AddCmd(&ishell.Cmd{ Name: "resume", @@ -111,41 +118,8 @@ func interact(fulldb bool) { }, }) - shell.AddCmd(&ishell.Cmd{ - Name: "add", - Help: "Add new Customer", - LongHelp: ` Usage: add - Add a new Customer to Database`, - Func: func(c *ishell.Context) { - addCustomer() - c.Println(promptcol("______________________")) - }, - }) - shell.AddCmd(&ishell.Cmd{ - Name: "startnow", - Help: "Start a new Task immediately", - LongHelp: ` Usage: startnow - Start a new Task in the currently open Project with current local time`, - Func: func(c *ishell.Context) { - newTask(false) - stdOut() - c.Println(promptcol("______________________")) - }, - }) - shell.AddCmd(&ishell.Cmd{ - Name: "stopnow", - Help: "Stop the currently Open Task immediately", - LongHelp: ` Usage: stopnow - Stop the open Task at the current local time. - If no task is open the user will be notified.`, - Func: func(c *ishell.Context) { - closeTask(true) - stdOut() - c.Println(promptcol("______________________")) - }, - }) shell.AddCmd(&ishell.Cmd{ Name: "checkbill", @@ -171,59 +145,67 @@ func interact(fulldb bool) { }, }) - shell.AddCmd(&ishell.Cmd{ - Name: "deletebill", - Help: "<id> Delete a Bill with the following id", - LongHelp: ` Usage: deletebill <id> + // Delete Commands: Bill / Task + { + delcmd := &ishell.Cmd{ + Name: "delete", + Help: "task / bill", + LongHelp: ` Usage: delete <command>`, + } + delcmd.AddCmd(&ishell.Cmd{ + Name: "bill", + Help: "<id> Delete a Bill with the following id", + LongHelp: ` Usage: delete bill <id> Delete the bill of the set <id> and set its Task back to unbilled`, - 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 { - deleteBill(argi) - stdOut() + 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 { + deleteBill(argi) + stdOut() + } else { + c.Println(boldRed(arg, "is not a valid id!")) + } } else { - c.Println(boldRed(arg, "is not a valid id!")) + c.Println(boldRed("deletebill <id> - Please enter an id")) + showLastBills(0) } - } else { - c.Println(boldRed("deletebill <id> - Please enter an id")) - showLastBills(0) - } - c.Println(promptcol("______________________")) - }, - }) - - shell.AddCmd(&ishell.Cmd{ - Name: "deletetask", - Help: "<id> Delete a Task with the following id", - LongHelp: ` Usage: deletetask <id> + c.Println(promptcol("______________________")) + }, + }) + delcmd.AddCmd(&ishell.Cmd{ + Name: "task", + Help: "<id> Delete a Task with the following id", + LongHelp: ` Usage: delete task <id> Delete the Task of the set <id>`, - 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 { - deleteTask(argi) - stdOut() + 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 { + deleteTask(argi) + stdOut() + } else { + c.Println(boldRed(arg, "is not a valid id!")) + } } else { - 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") - if choice > -1 { - deleteTask(selids[choice]) + tids := GetTaskIds() + selids, lids := GetTaskList(tids, false,false) + choice := c.MultiChoice(lids, "Select a Task to Edit") + if choice > -1 { + deleteTask(selids[choice]) + } + //c.Println(boldRed("deletetask <id> - Please enter an id")) + //allProjects() } - //c.Println(boldRed("deletetask <id> - Please enter an id")) - //allProjects() - } - c.Println(promptcol("______________________")) - }, - }) + c.Println(promptcol("______________________")) + }, + }) + shell.AddCmd(delcmd) + } shell.AddCmd(&ishell.Cmd{ Name: "project", @@ -257,202 +239,249 @@ func interact(fulldb bool) { }, }) - shell.AddCmd(&ishell.Cmd{ - Name: "edittask", - Help: "<id> Edit a Task of the following id", - LongHelp: ` Usage: edittask <id> + { + editcmd := &ishell.Cmd{ + Name: "edit", + Help: " customer / project / task", + LongHelp: ` Usage: edit <command>`, +/* customer <id> - Edit Customer of given id. + project <id> - Edit Project of given id. + task <id> - Edit Task of given id.`, */ + } + editcmd.AddCmd(&ishell.Cmd{ + Name: "task", + Help: "<id> Edit a Task of the following id", + LongHelp: ` Usage: edit task <id> Edit Task of the set <id>. Press <Enter> on empty line to keep the old entry`, - 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 { - editTask(argi) + 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 { + editTask(argi) + } else { + c.Println(boldRed(arg, "is not a valid id!")) + } } else { - 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") - //c.Println(tids) - //c.Println(selids) - if choice > -1 { - editTask(selids[choice]) - //c.Println(choice,selids[choice]) + tids := GetTaskIds() + selids, lids := GetTaskList(tids, false,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(boldRed("edittask <id> - Please enter an id")) - } - c.Println(promptcol("______________________")) - }, - }) - - shell.AddCmd(&ishell.Cmd{ - Name: "editproject", - Help: "<id> Edit the Project of the following id", - LongHelp: ` Usage: editproject <id> + c.Println(promptcol("______________________")) + }, + }) + editcmd.AddCmd(&ishell.Cmd{ + Name: "project", + Help: "<id> Edit the Project of the following id", + LongHelp: ` Usage: edit project <id> Edit Project of the set <id>. Press <Enter> on empty line to keep the old entry`, - 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 { - editProject(argi) - //allProjects() - //stdOut() + 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 { + editProject(argi) + //allProjects() + //stdOut() + } else { + c.Println(boldRed(arg, "is not a valid id!")) + } } else { - c.Println(boldRed(arg, "is not a valid id!")) - } - } else { - 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]) + 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(boldRed("editproject <id> - Please enter an id")) - //allProjects() - } - c.Println(promptcol("______________________")) - }, - }) - - shell.AddCmd(&ishell.Cmd{ - Name: "editcustomer", - Help: "<id> Edit the Customer of the following id", - LongHelp: ` Usage: editcustomer <id> + c.Println(promptcol("______________________")) + }, + }) + editcmd.AddCmd(&ishell.Cmd{ + Name: "customer", + Help: "<id> Edit the Customer of the following id", + LongHelp: ` Usage: edit customer <id> Edit Customer of the set <id>. Press <Enter> on empty line to keep the old entry`, - 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 { - editCustomer(argi) - allCustomers(false) - //stdOut() + 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 { + editCustomer(argi) + allCustomers(false) + //stdOut() + } else { + c.Println(boldRed(arg, "is not a valid id!")) + } } else { - c.Println(boldRed(arg, "is not a valid id!")) - } - } else { - selids, lids := getCustomerList() - choice := c.MultiChoice(lids, "Select a Customer to Edit") - if choice > -1 { - editCustomer(selids[choice]) + selids, lids := getCustomerList() + choice := c.MultiChoice(lids, "Select a Customer to Edit") + if choice > -1 { + editCustomer(selids[choice]) + } + //c.Println(boldRed("editcustomer <id> - Please enter an id")) + //allCustomers() } - //c.Println(boldRed("editcustomer <id> - Please enter an id")) - //allCustomers() - } - c.Println(promptcol("______________________")) - }, - }) + c.Println(promptcol("______________________")) + }, + }) + shell.AddCmd(editcmd) + } - shell.AddCmd(&ishell.Cmd{ - Name: "start", - Help: "<DateTime> - Start Task at a specific Time 'YYYY-MM-DD HH:MM' Or 'HH:MM'", - LongHelp: ` Usage: start <DateTime> + { + startcmd := &ishell.Cmd{ + Name: "start", + Help: "<DateTime>/now - Start a Task",// at a specific Time 'YYYY-MM-DD HH:MM' Or 'HH:MM' Or 'now'", + LongHelp: ` Usage: start <DateTime>/now Start a new Task in the currently open Project at <DateTime>. Use Format "YYYY-MM-DD HH:MM" or "HH:MM" for datetime. - If the latter is used the current local Date will be set.`, - Func: func(c *ishell.Context) { - arg := "none" - if len(c.Args) > 0 { - arg = strings.Join(c.Args, " ") - newTaskTime(arg) + If the latter is used the current local Date will be set. + 'now' will start the Task at current local time.`, + Func: func(c *ishell.Context) { + arg := "none" + if len(c.Args) > 0 { + arg = strings.Join(c.Args, " ") + newTaskTime(arg) + stdOut() + } else { + c.Println(boldRed("start <DateTime> - Please enter a Datetime")) + } + c.Println(promptcol("______________________")) + }, + } + startcmd.AddCmd(&ishell.Cmd{ + Name: "now", + Help: "Start a new Task immediately", + LongHelp: ` Usage: start now + Start a new Task in the currently open Project with current local time`, + Func: func(c *ishell.Context) { + newTask(false) stdOut() - } else { - c.Println(boldRed("start <DateTime> - Please enter a Datetime")) - } - c.Println(promptcol("______________________")) - }, - }) + c.Println(promptcol("______________________")) + }, + }) + shell.AddCmd(startcmd) + } - shell.AddCmd(&ishell.Cmd{ - Name: "stop", - Help: "<DateTime> - Stop Open Task at a specific Time 'YYYY-MM-DD HH:MM' Or 'HH:MM'", - LongHelp: ` Usage: stop <DateTime> + { + stopcmd := &ishell.Cmd{ + Name: "stop", + Help: "<DateTime>/now - Stop Open Task",// at a specific Time 'YYYY-MM-DD HH:MM' Or 'HH:MM'", + LongHelp: ` Usage: stop <DateTime>/now Stop the active Task at <DateTime>. Use Format "YYYY-MM-DD HH:MM" or "HH:MM" for datetime. If the latter is used the current local Date will be set. + 'now' will stop the Task at current local time. In case of a Stop-time before Task start user will be notified.`, - Func: func(c *ishell.Context) { - arg := "none" - if len(c.Args) > 0 { - arg = strings.Join(c.Args, " ") - closeTaskTime(arg) + Func: func(c *ishell.Context) { + arg := "none" + if len(c.Args) > 0 { + arg = strings.Join(c.Args, " ") + closeTaskTime(arg) + stdOut() + } else { + c.Println(boldRed("stop <DateTime> - Please enter a Datetime")) + } + c.Println(promptcol("______________________")) + }, + } + stopcmd.AddCmd(&ishell.Cmd{ + Name: "now", + Help: "Stop the currently Open Task immediately", + LongHelp: ` Usage: stop now + Stop the open Task at the current local time. + If no task is open the user will be notified.`, + Func: func(c *ishell.Context) { + closeTask(true) stdOut() - } else { - c.Println(boldRed("stop <DateTime> - Please enter a Datetime")) - } - c.Println(promptcol("______________________")) - }, - }) - - shell.AddCmd(&ishell.Cmd{ - Name: "all", - Help: "Show all Projects", - LongHelp: ` Usage: all - Show all Projects with small summary sorted by Customer.`, - Func: func(c *ishell.Context) { - allProjects() - stdOut() - c.Println(promptcol("______________________")) - }, - }) + c.Println(promptcol("______________________")) + }, + }) + shell.AddCmd(stopcmd) + } - shell.AddCmd(&ishell.Cmd{ - Name: "allbills", - Help: "Show all Bills", - LongHelp: ` Usage: allbills + { + showcmd := &ishell.Cmd{ + Name: "show", + Help: "all / customers / bills", + LongHelp: ` Usage: show <command>`, +// Show all Projects with a small summary sorted by Customer.`, + } + showcmd.AddCmd(&ishell.Cmd{ + Name: "all", + Help: "Show all Projects sorted by customers", + LongHelp: ` Usage: show all + Show all Projects with a small summary, sorted by Customer.`, + Func: func(c *ishell.Context) { + allProjects() + stdOut() + c.Println(promptcol("______________________")) + }, + }) + /* showcmd.AddCmd(&ishell.Cmd{ + Name: "bills", + Help: "Show all Bills", + LongHelp: ` Usage: all bills Show all previous Bills with small summary.`, - Func: func(c *ishell.Context) { - showLastBills(0) - c.Println(promptcol("______________________")) - }, - }) - - shell.AddCmd(&ishell.Cmd{ - Name: "allcustomers", - Help: "Show all Customers", - LongHelp: ` Usage: allcustomers + Func: func(c *ishell.Context) { + showLastBills(0) + c.Println(promptcol("______________________")) + }, + }) */ + showcmd.AddCmd(&ishell.Cmd{ + Name: "customers", + Help: "Show all Customers", + LongHelp: ` Usage: all customers Show all Customers.`, - Func: func(c *ishell.Context) { - allCustomers(false) - c.Println(promptcol("______________________")) - }, - }) - - shell.AddCmd(&ishell.Cmd{ - Name: "showbills", - Help: "<n> - Show the last n bills", - LongHelp: ` Usage: showbills <n> - Show the last n Bills with a small summary.`, - Func: func(c *ishell.Context) { - //c.ClearScreen() - arg := "none" - if len(c.Args) > 0 { - arg = strings.Join(c.Args, " ") - argi, err := strconv.Atoi(arg) - if err == nil { - showLastBills(argi) + Func: func(c *ishell.Context) { + allCustomers(false) + c.Println(promptcol("______________________")) + }, + }) + showcmd.AddCmd(&ishell.Cmd{ + Name: "bills", + Help: "<n> - Show the last n bills. If no n specified all Bills are shown ", + LongHelp: ` Usage: all bills <n> + Show the last n Bills with a small summary. If no <n> is specified all bills are shown.`, + Func: func(c *ishell.Context) { + //c.ClearScreen() + arg := "none" + if len(c.Args) > 0 { + arg = strings.Join(c.Args, " ") + argi, err := strconv.Atoi(arg) + if err == nil { + showLastBills(argi) + } else { + c.Println(boldRed(arg, "is not a valid integer!")) + } } else { - c.Println(boldRed(arg, "is not a valid integer!")) + showLastBills(0) + //c.Println(boldRed("showbills <n> - Please enter an integer")) } - } else { - c.Println(boldRed("showbills <n> - Please enter an integer")) - } - //stdOut() - c.Println(promptcol("______________________")) - }, - }) + //stdOut() + c.Println(promptcol("______________________")) + }, + }) + shell.AddCmd(showcmd) + } /* // multiple choice shell.AddCmd(&ishell.Cmd{ @@ -493,75 +522,126 @@ func interact(fulldb bool) { }) */ //Test stuff in shell - shell.AddCmd(&ishell.Cmd{ - Name: "test", - Help: "Test some functions in interactive mode", - LongHelp: ` Usage: test + { + //var autostuff = []string{"fuck This is Awsome","this cannot be real","shit my pants"} + testcmd := &ishell.Cmd{ + Name: "test", + Help: "Test some functions in interactive mode", + LongHelp: ` Usage: test Test functions in interactive mode`, - Func: func(c *ishell.Context) { + Func: func(c *ishell.Context) { + if len(c.Args) > 0 { + c.Println("SomeArgs",c.Args) + }else{ + c.Println("No Args") + } + }, + } + testcmd.AddCmd(&ishell.Cmd{ + Name: "new", + Help: "Test export", + LongHelp: ` Usage: export + Test Export`, + Func: func(c *ishell.Context) { + c.Println("Said new!!!") + //getInterAutoInput("Really?",autostuff) + }, + }) + testcmd.AddCmd(&ishell.Cmd{ + Name: "export", + Help: "Test export", + LongHelp: ` Usage: export + Test Export`, + Func: func(c *ishell.Context) { //multichoice("Geh scheissn") - //nm,st := GetTaskSums(currproject.Id) - //i := Multichoice("Sicha?",st) - //fmt.Println(nm[i]) - prid := GetProjectIds() - cuid := GetCustomerIds() - taid := GetTaskIds() - prs := GetSelectedProjects(prid) - cus := GetSelectedCustomers(cuid) - tas := GetSelectedTasks(taid) - c.Println("Tasks:",len(tas)) - c.Println("Projects:",len(prs)) - c.Println("Customers:",len(cus)) - //c.Println("Customers:",cus) - if isInterSure("Export ?"){ - ExportCustomers(cus) - ExportProjects(prs) - ExportTasks(tas) - TarExports("exports.tar") - PurgeTemps() - } - - if isInterSure("Import ?"){ - UnTarExports("exports.tar") - icus := ImportCustomers() - itas := ImportTasks() - iprs := ImportProjects() - PurgeTemps() - c.Println("Imported Customers:",len(icus)) - c.Println("Imported Projects:",len(iprs)) - c.Println("Imported Tasks:",len(itas)) - SaveImportsToDB(icus,iprs,itas) - } - + //nm,st := GetTaskSums(currproject.Id) + //i := Multichoice("Sicha?",st) + //fmt.Println(nm[i]) + prid := GetProjectIds() + cuid := GetCustomerIds() + taid := GetTaskIds() + prs := GetSelectedProjects(prid) + cus := GetSelectedCustomers(cuid) + tas := GetSelectedTasks(taid) + c.Println("Tasks:",len(tas)) + c.Println("Projects:",len(prs)) + c.Println("Customers:",len(cus)) + //c.Println("Customers:",cus) + if isInterSure("Export ?"){ + ExportCustomers(cus) + ExportProjects(prs) + ExportTasks(tas) + TarExports("exports.tar") + PurgeTemps() + } + }, + }) + testcmd.AddCmd(&ishell.Cmd{ + Name: "import", + Help: "Test import", + LongHelp: ` Usage: import + Test Import functions`, + Func: func(c *ishell.Context) { + //autostuff = append(autostuff,"scheissdreck") + if isInterSure("Import ?"){ + UnTarExports("exports.tar") + icus := ImportCustomers() + itas := ImportTasks() + iprs := ImportProjects() + PurgeTemps() + c.Println("Imported Customers:",len(icus)) + c.Println("Imported Projects:",len(iprs)) + c.Println("Imported Tasks:",len(itas)) + SaveImportsToDB(icus,iprs,itas) + } + }, //c.Println("Projects:",iprs) - }, - }) + }) + shell.AddCmd(testcmd) + } - // Prompt Color - shell.AddCmd(&ishell.Cmd{ - Name: "colorprompt", - Help: "Select the Color of the prompt", - LongHelp: ` Usage: colorprompt + // Config Commands + { + confcmd := &ishell.Cmd{ + Name: "config", + Help: "View and Edit Configuration", + LongHelp: ` Usage: config [<commands>] + Show the current configuration and ask if it should be edited. + Configurations contains the location of the database file + and the Personal Data needed for charging. + If config is edited press <Enter> on empty line to keep the old entry`, + Func: func(c *ishell.Context) { + editConf() + c.Println(promptcol("______________________")) + }, + } + // Prompt Color + confcmd.AddCmd(&ishell.Cmd{ + Name: "color", + Help: "Select the Color of the prompt", + LongHelp: ` Usage: config color 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?") - promptcol = PromptColor(choice).SprintFunc() - //promptcol = mastercol.SprintFunc() - - c.SetPrompt(promptcol(">>>")) - c.Println(promptcol("As You Wish!")) - - c.Println(promptcol("______________________")) - }, - }) + 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?") + promptcol = PromptColor(choice).SprintFunc() + //promptcol = mastercol.SprintFunc() + + c.SetPrompt(promptcol(">>>")) + c.Println(promptcol("As You Wish!")) + + c.Println(promptcol("______________________")) + }, + }) + shell.AddCmd(confcmd) + } // Gather Tasks For Bills shell.AddCmd(&ishell.Cmd{ Name: "charge", @@ -760,14 +840,13 @@ func getInterAutoInput(question string,autocom []string) (out string) { shell.ShowPrompt(false) defer shell.ShowPrompt(true) shell.AddCmd(&ishell.Cmd{ - Name: "fun", + Name: "", Help: "never to be seen", Completer: func([]string) []string { - return autocom - }, + return autocom}, Func: func(c *ishell.Context) { - shell.Print(question) + c.Print(question) //out = shell.ReadLine() out = fmt.Sprint(c.Args) }, @@ -776,7 +855,7 @@ func getInterAutoInput(question string,autocom []string) (out string) { //shell.SetRootCmd("fun") shell.Run() return -}*/ +} */ func getInterInput(question string) (out string) { shell := ishell.New() |
