summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interact.go47
-rw-r--r--main.go11
-rwxr-xr-xmakefile1
3 files changed, 8 insertions, 51 deletions
diff --git a/interact.go b/interact.go
index 741d622..4ed7bc8 100644
--- a/interact.go
+++ b/interact.go
@@ -51,8 +51,6 @@ func interact() {
Help: "View and Edit Configuration",
LongHelp: "Contains the location of the database file and the Personal Data needed for billing",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
- //c.Println(boldGreen("Start New Project"))
editConf()
c.Println(promptcol("______________________"))
},
@@ -62,8 +60,6 @@ func interact() {
Name: "status",
Help: "Show Current Project and Tasks",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
- //c.Println(boldGreen("Start New Project"))
stdOut()
c.Println(promptcol("______________________"))
},
@@ -73,8 +69,6 @@ func interact() {
Name: "add",
Help: "Add new Customer",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
- //c.Println(boldGreen("Start New Project"))
addCustomer()
c.Println(promptcol("______________________"))
},
@@ -84,7 +78,6 @@ func interact() {
Name: "startnow",
Help: "Start a new Task immediately",
Func: func(c *ishell.Context) {
- //c.Println(boldGreen("New Task"))
newTask(currproject.id)
stdOut()
c.Println(promptcol("______________________"))
@@ -95,8 +88,6 @@ func interact() {
Name: "stopnow",
Help: "Stop the currently Open Task immediately",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
- //c.Println(boldGreen("Stoping Task",opentask.id))
closeTask()
stdOut()
c.Println(promptcol("______________________"))
@@ -107,13 +98,11 @@ func interact() {
Name: "deletebill",
Help: "<id> Delete a Bill with the following id",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
arg := "none"
if len(c.Args) > 0 {
arg = strings.Join(c.Args, " ")
argi,err := strconv.Atoi(arg)
if err == nil{
- //c.Println(boldGreen("Opening Project",argi))
deleteBill(argi)
stdOut()
}else{
@@ -131,13 +120,11 @@ func interact() {
Name: "deletetask",
Help: "<id> Delete a Task with the following id",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
arg := "none"
if len(c.Args) > 0 {
arg = strings.Join(c.Args, " ")
argi,err := strconv.Atoi(arg)
if err == nil{
- //c.Println(boldGreen("Opening Project",argi))
deleteTask(argi)
stdOut()
}else{
@@ -155,13 +142,11 @@ func interact() {
Name: "project",
Help: "<id> Open a Project of the following id",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
arg := "none"
if len(c.Args) > 0 {
arg = strings.Join(c.Args, " ")
argi,err := strconv.Atoi(arg)
if err == nil{
- //c.Println(boldGreen("Opening Project",argi))
setProject(argi)
stdOut()
}else{
@@ -179,15 +164,12 @@ func interact() {
Name: "edittask",
Help: "<id> Edit a Task of the following id",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
arg := "none"
if len(c.Args) > 0 {
arg = strings.Join(c.Args, " ")
argi,err := strconv.Atoi(arg)
if err == nil{
- //c.Println(boldGreen("Editing Task",argi))
editTask(argi)
- //stdOut()
}else{
c.Println(boldRed(arg,"is not a valid id!"))
}
@@ -202,7 +184,6 @@ func interact() {
Name: "editproject",
Help: "<id> Edit the Project of the following id",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
arg := "none"
if len(c.Args) > 0 {
arg = strings.Join(c.Args, " ")
@@ -226,13 +207,11 @@ func interact() {
Name: "editcustomer",
Help: "<id> Edit the Customer of the following id",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
arg := "none"
if len(c.Args) > 0 {
arg = strings.Join(c.Args, " ")
argi,err := strconv.Atoi(arg)
if err == nil{
- //c.Println(boldGreen("Edit Project",argi))
editCustomer(argi)
allCustomers()
//stdOut()
@@ -254,9 +233,7 @@ func interact() {
arg := "none"
if len(c.Args) > 0 {
arg = strings.Join(c.Args, " ")
- //c.Println(boldGreen("Start Project at",arg))
newTaskTime(currproject.id,arg)
- // editProject(argi)
stdOut()
}else{
c.Println(boldRed("start <DateTime> - Please enter a Datetime"))
@@ -269,11 +246,9 @@ func interact() {
Name: "stop",
Help: "<DateTime> - Stop Open Task at a specific Time 'YYYY-MM-DD HH:MM' Or 'HH:MM'",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
arg := "none"
if len(c.Args) > 0 {
arg = strings.Join(c.Args, " ")
- //c.Println(boldGreen("Stop Task at",arg))
closeTaskTime(arg)
stdOut()
}else{
@@ -287,10 +262,6 @@ func interact() {
Name: "all",
Help: "Show all Projects",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
- //c.Println(boldGreen("Start New Project"))
- //c.ClearScreen()
- //c.Println(boldBlue(">> All Projects\n"))
allProjects()
stdOut()
c.Println(promptcol("______________________"))
@@ -301,9 +272,6 @@ func interact() {
Name: "allbills",
Help: "Show all Bills",
Func: func(c *ishell.Context) {
- //c.Print("\033[H\033[2J")
- //c.Println(boldGreen("Start New Project"))
- //c.Println(boldBlue(">> All Bills\n"))
showLastBills(0)
c.Println(promptcol("______________________"))
},
@@ -326,24 +294,11 @@ func interact() {
}else{
c.Println(boldRed("showbills <n> - Please enter an integer"))
}
- //c.Print("\033[H\033[2J")
- //c.Println(boldGreen("Start New Project"))
//stdOut()
c.Println(promptcol("______________________"))
},
})
/*
- shell.AddCmd(&ishell.Cmd{
- Name: "color",
- Help: "color print",
- Func: func(c *ishell.Context) {
- c.Print(cyan("cyan\n"))
- c.Print(green("greencyan\n"))
- c.Println(yellow("yellow"))
- c.Printf("%s\n", boldRed("bold red"))
- },
- })
-
// multiple choice
shell.AddCmd(&ishell.Cmd{
Name: "choice",
@@ -579,7 +534,7 @@ func interact() {
// teardown
shell.Close()
}
- fmt.Println("Laboravi emeritus...")
+ //fmt.Println("Laboravi emeritus...")
}
diff --git a/main.go b/main.go
index 4ba7419..0ba4902 100644
--- a/main.go
+++ b/main.go
@@ -100,7 +100,7 @@ func main() {
getopt.Parse()
interArgs = getopt.Args()
- fmt.Println(interArgs)
+ //fmt.Println(interArgs)
dbname := "./.mytimes.db"
if len(interArgs) > 0 {
@@ -110,7 +110,7 @@ func main() {
}
if help {
- fmt.Printf("Usage of %s Version %s (%s):\n Use Commands as Parameters\n\n", os.Args[0],version,compdate)
+ fmt.Printf("Usage of %s Version %s:\n Use Commands as Parameters\n\n", os.Args[0],version)
getopt.Usage()
interArgs = append([]string{"help"},interArgs...)
@@ -145,11 +145,12 @@ func main() {
}
if !help {
- initDB(dbname)
- getLastProject()
- getOpenTask()
+ initDB(dbname)
+ getLastProject()
+ getOpenTask()
}
interact()
+ fmt.Println("Laboravi emeritus...")
}
diff --git a/makefile b/makefile
index fa35690..b9cc10b 100755
--- a/makefile
+++ b/makefile
@@ -24,6 +24,7 @@ fetch_stuff:
@go get github.com/abiosoft/ishell
@go get github.com/BurntSushi/toml
@go get github.com/atrox/homedir
+ @go get github.com/pborman/getopt/v2
@mkdir -p outpdf
@mkdir -p outtex
@echo "All nessecary libaries installed"