diff options
| author | Nikolaus Gotsche <n@softwarefools.com> | 2018-01-25 03:23:19 +0100 |
|---|---|---|
| committer | Nikolaus Gotsche <n@softwarefools.com> | 2018-01-25 03:23:19 +0100 |
| commit | 2d5c636a16f8b1eeff86e82f1b3c041d9b301796 (patch) | |
| tree | a02a4663439265c70d9c79217225d59f4229e0fa /main.go | |
| parent | 2b1503c57722a417038d3e2dafa7faa23ef59a5b (diff) | |
Added Interactive Mode
And Colours
Gerneral Debugging
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 66 |
1 files changed, 48 insertions, 18 deletions
@@ -8,19 +8,34 @@ import ( "os" //"strings" _ "os/exec" + //"github.com/fatih/color" ) //var svar string var starttime,stoptime string var projectid, edittaskid, editprojectid int -var newproject, newtask, stoptask, allproj bool +var newproject, newtask, stoptask, allproj, runinter bool + +//var red, green, yellow, cyan color +//var boldRed, boldGreen color func init() { + //red := color.New(color.FgRed).SprintFunc + //green := color.New(color.FgGreen) + //yellow := color.New(color.FgYellow) + //use of package color without selectorcyan := color.New(color.FgCyan) + //boldGreen := color.New(color.FgGreen, color.Bold) + //boldRed := color.New(color.FgRed, color.Bold) + flag.BoolVar(&allproj, "all", false, "Show all Projects") + flag.BoolVar(&runinter, + "run", + false, + "Run in Interactive mode") flag.BoolVar(&newtask, "startnow", false, @@ -59,6 +74,13 @@ func init() { } +func stdOut() { + + showLastProject() + getClosedTasks(0) + showOpenTask() +} + func main() { if len(flag.Args())>0 { fmt.Println("Unknown Commands: ",flag.Args()) @@ -72,43 +94,51 @@ func main() { if allproj { allProjects() } + + if runinter { + interact() + } if newproject { newProject() os.Exit(0) } else if newtask { newTask(projectid) - showLastProject() - getClosedTasks(0) - showOpenTask() - os.Exit(0) + stdOut() + //showLastProject() + //getClosedTasks(0) + //showOpenTask() + //os.Exit(0) } else if stoptask { closeTask() - showLastProject() - getClosedTasks(0) - showOpenTask() + stdOut() + //showLastProject() + //getClosedTasks(0) + //showOpenTask() } else if (starttime != "now") { newTaskTime(projectid,starttime) os.Exit(0) } else if (stoptime != "now") { closeTaskTime(stoptime) - showLastProject() - getClosedTasks(0) - showOpenTask() + stdOut() + //showLastProject() + //getClosedTasks(0) + //showOpenTask() } else if (edittaskid>0) { editTask(edittaskid) } else if (editprojectid>0) { editProject(editprojectid) } else if (projectid>0) { setProject(projectid) - showLastProject() - getClosedTasks(0) - showOpenTask() + stdOut() + //showLastProject() + //getClosedTasks(0) + //showOpenTask() } else { - showLastProject() - getClosedTasks(0) - showOpenTask() - + //showLastProject() + //getClosedTasks(0) + //showOpenTask() + stdOut() } //fmt.Println("Start Act:",actstart) |
