summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2018-01-14 05:32:44 +0100
committerNikolaus Gotsche <n@softwarefools.com>2018-01-14 05:32:44 +0100
commit4c1961ce7a2bf9e5526d906ba2c317b53ed5f331 (patch)
tree5f7d1b68d37544ffacd9f4c9df0b042b285e91a7 /main.go
parentd9675b282394973d0755f1484fc5ebe452423de2 (diff)
Verison 0.1 - All Database Operations running
Diffstat (limited to 'main.go')
-rw-r--r--main.go112
1 files changed, 101 insertions, 11 deletions
diff --git a/main.go b/main.go
index c54740e..735630d 100644
--- a/main.go
+++ b/main.go
@@ -3,21 +3,111 @@ package main
import (
"fmt"
"flag"
- "log"
+ _ "log"
+ "bufio"
"os"
"strings"
- "os/exec"
+ _ "os/exec"
)
-func main() {
- fmt.Println("Hello World")
- command := flag.String(
- "command",
- "",
- "The MAin Command")
- ignoreErrors := flag.Bool(
- "ignore-errors",
+var svar string
+var starttime,stoptime string
+var projectid int
+var newproject, newtask, stoptask, allproj bool
+
+func init() {
+
+ flag.BoolVar(&allproj,
+ "all",
+ false,
+ "Show all Projects")
+ flag.BoolVar(&newtask,
+ "start",
false,
- "Keep running after error if true")
+ "Start a new Task in current project")
+ flag.IntVar(&projectid,
+ "project",
+ 0,
+ "Specify which project to track")
+ flag.BoolVar(&stoptask,
+ "stop",
+ false,
+ "Stop the currently open task")
+ flag.StringVar(&starttime,
+ "starttime",
+ "now",
+ "")
+ flag.StringVar(&stoptime,
+ "stoptime",
+ "now",
+ "Stop to Track a Project")
+ flag.BoolVar(&newproject,
+ "new",
+ false,
+ "Create a new project")
+ flag.StringVar(&svar, "svar", "bar", "A String Var")
+
flag.Parse()
+
+}
+
+func main() {
+ fmt.Println("Laboravi Started")
+ initDB("./.mytimes.db")
+ getLastProject()
+ //getProjects()
+ getOpenTask()
+
+ if allproj {
+ allProjects()
+ }
+
+ if newproject {
+ fmt.Print("Enter Project Name: ")
+ //var input string
+ //fmt.Scanln(&input)
+ in := bufio.NewReader(os.Stdin)
+ line, err := in.ReadString('\n')
+ line = strings.TrimSuffix(line, "\n")
+ checkErr(err)
+// fmt.Println(line)
+ newProject(line)
+ os.Exit(0)
+ } else if newtask {
+ fmt.Print("Specify Task: ")
+ in := bufio.NewReader(os.Stdin)
+ line, err := in.ReadString('\n')
+ line = strings.TrimSuffix(line, "\n")
+ checkErr(err)
+ // fmt.Println(line)
+ newTask(projectid,line)
+ os.Exit(0)
+ } else if stoptask {
+ closeTask()
+ showLastProject()
+ getClosedTasks(0)
+ //fmt.Print("Soon to Come...")
+ } else if (starttime != "now") {
+ //fmt.Println("HmmmWTF")
+ fmt.Print("Soon to Come...")
+ } else if (stoptime != "now") {
+ fmt.Print("Soon to Come...")
+ } else if (projectid>0) {
+ setProject(projectid)
+ showLastProject()
+ getClosedTasks(0)
+ showOpenTask()
+ } else {
+ showLastProject()
+ getClosedTasks(0)
+ showOpenTask()
+
+ }
+
+ //fmt.Println("Start Act:",actstart)
+ //fmt.Println("Stop Act:",actstop)
+ //fmt.Println("Project:",projectid)
+ //fmt.Println("New Project:",newproject)
+ //fmt.Println("svar:",svar)
+ fmt.Println("Unknown Commands: ",flag.Args())
}