diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2018-09-12 02:37:44 +0200 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2018-09-12 02:37:44 +0200 |
| commit | 06c06f5f6427f6da22b2476fa208e8c4ce54b7ee (patch) | |
| tree | b1ecc69ccc3ca6e915b6f4084598b530fbf24d04 /main.go | |
| parent | fd4a4409ee8e6b772db30611e968778b68eca0d6 (diff) | |
Conf/DB into Home Dir, general beautification and debug
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 37 |
1 files changed, 29 insertions, 8 deletions
@@ -17,12 +17,13 @@ var starttime,stoptime string var projectid, edittaskid, editprojectid, editcustomerid int var deltask int var addcustomer bool -var newproject, newtask, stoptask, allproj, runinter, test, newconfig bool +var newproject, newtask, stoptask, allproj, allbills, runinter, test, newconfig bool +var billcount int //var red, green, yellow, cyan color //var boldRed, boldGreen color -func title() { +func title(frame bool) { bR := color.New(color.FgRed, color.Bold).SprintFunc() bHiR := color.New(color.FgHiRed, color.Bold).SprintFunc() bHiY := color.New(color.FgHiYellow, color.Bold).SprintFunc() @@ -33,10 +34,14 @@ func title() { bM := color.New(color.FgMagenta, color.Bold).SprintFunc() line := "___" - fmt.Printf("%s%s%s%s%s%s%s%s\n\n",bR(line),bHiR(line),bHiY(line),bHiG(line),bHiC(line),bHiB(line),bHiM(line),bM(line)) + if frame { + fmt.Printf("%s%s%s%s%s%s%s%s\n\n",bR(line),bHiR(line),bHiY(line),bHiG(line),bHiC(line),bHiB(line),bHiM(line),bM(line)) + } fmt.Println(" ",bR("L"),bHiR("A"),bHiY("B"),bHiG("O"),bHiC("R"),bHiB("A"),bHiM("V"),bM("I")) - fmt.Printf("%s%s%s%s%s%s%s%s\n",bR(line),bHiR(line),bHiY(line),bHiG(line),bHiC(line),bHiB(line),bHiM(line),bM(line)) - fmt.Println("(c) 2018 - n@gotsche.at\n") + if frame { + fmt.Printf("%s%s%s%s%s%s%s%s\n",bR(line),bHiR(line),bHiY(line),bHiG(line),bHiC(line),bHiB(line),bHiM(line),bM(line)) + fmt.Println("(c) 2018 - n@gotsche.at\n") + } } @@ -67,6 +72,14 @@ func init() { "all", false, "Show all Projects") + flag.BoolVar(&allbills, + "allbills", + false, + "Show all Bills") + flag.IntVar(&billcount, + "showbills", + 0, + "How Many of Previous bills should be shown") flag.BoolVar(&runinter, "run", false, @@ -132,12 +145,14 @@ func stdOut() { } func main() { + boldRed := color.New(color.FgRed, color.Bold).SprintFunc() //fmt.Println("Laboravi Started") dbname := "./.mytimes.db" if flag.NFlag() > 0 { - title() + title(true) }else{ - fmt.Println("Laboravi Started") + title(false) + //fmt.Println("Laboravi Started") } initConf() dbname = config.Database @@ -159,7 +174,7 @@ func main() { } } if len(uar)>0 { - fmt.Println("Unknown Commands: ",uar) + fmt.Println("Unknown Commands: ",boldRed(uar)) } } @@ -182,6 +197,12 @@ func main() { allProjects() } + if allbills { + showLastBills(0) + } else if (billcount>0) { + showLastBills(billcount) + } + if runinter { interact() } |
