diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2018-09-23 23:58:33 +0200 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2018-09-23 23:58:33 +0200 |
| commit | d971540ec6efdec601505b6c8b55dcd85072f8e0 (patch) | |
| tree | 8fa332ac8a8b9ca10d0be12813531f7ecf92fedb | |
| parent | d02ae5617f2deb600982833da9a927a5a9d66793 (diff) | |
LongHelp added, temporarely switched to ishell fork
| -rw-r--r-- | interact.go | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/interact.go b/interact.go index 4ed7bc8..6616f8f 100644 --- a/interact.go +++ b/interact.go @@ -7,7 +7,8 @@ import ( "fmt" "time" - "github.com/abiosoft/ishell" + //"github.com/abiosoft/ishell" + "github.com/EPRparadox82/ishell" "github.com/fatih/color" ) @@ -15,6 +16,8 @@ import ( func interact() { //stdOut() shell := ishell.New() + shell.SetMultiChoicePrompt(" ->"," - ") + shell.SetChecklistOptions("[ ] ","[X] ") //fmt.Println(os.Args) //cyan := color.New(color.FgCyan).SprintFunc() @@ -36,7 +39,9 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "new", Help: "Start new Project", - LongHelp: "If no Task is currently running a new project will be added to database and activated", + LongHelp: ` Usage: new + 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")) @@ -49,7 +54,10 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "config", Help: "View and Edit Configuration", - LongHelp: "Contains the location of the database file and the Personal Data needed for billing", + 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("______________________")) @@ -59,6 +67,8 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "status", Help: "Show Current Project and Tasks", + LongHelp: ` Usage: status + Shows the current Project, its last Tasks and if there is a open Task.`, Func: func(c *ishell.Context) { stdOut() c.Println(promptcol("______________________")) @@ -68,6 +78,8 @@ func interact() { 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("______________________")) @@ -77,6 +89,8 @@ func interact() { 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(currproject.id) stdOut() @@ -87,6 +101,9 @@ func interact() { 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() stdOut() @@ -97,6 +114,8 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "deletebill", Help: "<id> Delete a Bill with the following id", + LongHelp: ` Usage: deletebill <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 { @@ -119,6 +138,8 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "deletetask", Help: "<id> Delete a Task with the following id", + LongHelp: ` Usage: deletetask <id> + Delete the Task of the set <id>`, Func: func(c *ishell.Context) { arg := "none" if len(c.Args) > 0 { @@ -141,6 +162,9 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "project", Help: "<id> Open a Project of the following id", + LongHelp: ` Usage: project <id> + Open the Project with the set <id> + If there is an open Task the user will be notified to close it first.`, Func: func(c *ishell.Context) { arg := "none" if len(c.Args) > 0 { @@ -163,6 +187,9 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "edittask", Help: "<id> Edit a Task of the following id", + LongHelp: ` Usage: edittask <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 { @@ -183,6 +210,9 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "editproject", Help: "<id> Edit the Project of the following id", + LongHelp: ` Usage: editproject <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 { @@ -206,6 +236,9 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "editcustomer", Help: "<id> Edit the Customer of the following id", + LongHelp: ` Usage: editcustomer <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 { @@ -229,6 +262,10 @@ func interact() { 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> + 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 { @@ -245,6 +282,11 @@ func interact() { 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> + 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. + 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 { @@ -261,6 +303,8 @@ func interact() { 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() @@ -271,6 +315,8 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "allbills", Help: "Show all Bills", + LongHelp: ` Usage: allbills + Show all previous Bills with small summary.`, Func: func(c *ishell.Context) { showLastBills(0) c.Println(promptcol("______________________")) @@ -280,6 +326,8 @@ func interact() { 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" @@ -340,9 +388,11 @@ func interact() { // Prompt Color shell.AddCmd(&ishell.Cmd{ - Name: "colorprompt", - Help: "Select the Color of the prompt", - Func: func(c *ishell.Context) { + Name: "colorprompt", + Help: "Select the Color of the prompt", + LongHelp: ` Usage: colorprompt + Select the color of the prompt`, + Func: func(c *ishell.Context) { choice := c.MultiChoice([]string{ boldMag("Magenta"), boldBlue("Blue"), @@ -380,6 +430,10 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "bill", Help: "Select Tasks to be billed", + LongHelp: ` Usage: bill + Select the tasks that should be merged into a Bill. + The Initial selection cannot be changed afterward. Only the complete + bill can be deleted and a new selection made.`, Func: func(c *ishell.Context) { nix := []int{0} ids,str := getTaskList(nix,true) |
