From 06c06f5f6427f6da22b2476fa208e8c4ce54b7ee Mon Sep 17 00:00:00 2001 From: Nikolaus Gotsche Date: Wed, 12 Sep 2018 02:37:44 +0200 Subject: Conf/DB into Home Dir, general beautification and debug --- interact.go | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'interact.go') diff --git a/interact.go b/interact.go index b494222..e336535 100644 --- a/interact.go +++ b/interact.go @@ -16,8 +16,8 @@ func interact() { stdOut() shell := ishell.New() - cyan := color.New(color.FgCyan).SprintFunc() - yellow := color.New(color.FgYellow).SprintFunc() + //cyan := color.New(color.FgCyan).SprintFunc() + //yellow := color.New(color.FgYellow).SprintFunc() green := color.New(color.FgGreen).SprintFunc() // boldGreen := color.New(color.FgGreen, color.Bold).SprintFunc() boldRed := color.New(color.FgRed, color.Bold).SprintFunc() @@ -165,7 +165,6 @@ func interact() { arg = strings.Join(c.Args, " ") argi,err := strconv.Atoi(arg) if err == nil{ - //c.Println(boldGreen("Edit Project",argi)) editProject(argi) allProjects() //stdOut() @@ -239,7 +238,7 @@ func interact() { shell.AddCmd(&ishell.Cmd{ Name: "all", - Help: "Show all Projects Project", + Help: "Show all Projects", Func: func(c *ishell.Context) { //c.Print("\033[H\033[2J") //c.Println(boldGreen("Start New Project")) @@ -248,7 +247,38 @@ func interact() { }, }) + shell.AddCmd(&ishell.Cmd{ + Name: "allbills", + Help: "Show all Bills", + Func: func(c *ishell.Context) { + //c.Print("\033[H\033[2J") + //c.Println(boldGreen("Start New Project")) + showLastBills(0) + }, + }) + shell.AddCmd(&ishell.Cmd{ + Name: "showbills", + Help: " - Show the last n bills", + 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{ + showLastBills(argi) + }else{ + c.Println(boldRed(arg,"is not a valid integer!")) + } + }else{ + c.Println(boldRed("showbills - Please enter an integer")) + } + //c.Print("\033[H\033[2J") + //c.Println(boldGreen("Start New Project")) + stdOut() + }, + }) +/* shell.AddCmd(&ishell.Cmd{ Name: "color", Help: "color print", @@ -297,7 +327,7 @@ func interact() { c.Println("Your choices are", strings.Join(out(), ", ")) }, }) - +*/ // Gather Tasks For Bills shell.AddCmd(&ishell.Cmd{ Name: "bill", -- cgit v1.2.3