diff options
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) |
