summaryrefslogtreecommitdiff
path: root/sqlite.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2018-10-26 01:23:24 +0200
committerNikolaus Gotsche <n@softwarefools.com>2018-10-26 01:23:24 +0200
commit1312d9dc80d3c43fce59e41ca3798abafd67e5f3 (patch)
treee5a0b075c7cf41f3dd9235009dd3202cd61f39bd /sqlite.go
parent25e12980c0448cb58e545fffa137905fd861dea3 (diff)
Colorprompt saved
Diffstat (limited to 'sqlite.go')
-rw-r--r--sqlite.go57
1 files changed, 55 insertions, 2 deletions
diff --git a/sqlite.go b/sqlite.go
index dcb76b9..5c07fd0 100644
--- a/sqlite.go
+++ b/sqlite.go
@@ -159,6 +159,23 @@ func lastUsage() (out string) {
return
}
+func GetColor() (col int) {
+ rows, err := db.Query("SELECT color FROM vars WHERE id = 1")
+ checkErr(err)
+ for rows.Next() {
+ err = rows.Scan(&col)
+ checkErr(err)
+ }
+ return
+}
+
+func SetColor(col int) {
+ stmt, err := db.Prepare("UPDATE vars SET color = ? WHERE id = 1")
+ checkErr(err)
+ _, err = stmt.Exec(col)
+ checkErr(err)
+}
+
func getPauseTask() (id int) {
rows, err := db.Query("SELECT pauseid FROM vars WHERE id = 1")
checkErr(err)
@@ -240,7 +257,7 @@ func newTask(resume bool) {
fmt.Println(nli+boldRed("No Task was Paused"))
if isInterSure(nli+"Resume older task?"){
nm,st := GetTaskSums(currproject.id)
- ch := Multichoice("What Task should be resumed?",st)
+ ch := Multichoice(frame("What Task should be resumed?",true),st)
task = nm[ch]
}else{
fmt.Println(frame(negR(),false))
@@ -735,7 +752,7 @@ func AnalyzeTasks(in []task) (count int, hours float64, duration string) {
}
//txt := fmt.Sprintf("%s - (%v) - %.2f h",task, durstr, dur)
}
- duration = fmt.Sprintf("%v - %v", lstart.Local().Format("01.02."), hstop.Local().Format("01.02.2006"))
+ duration = fmt.Sprintf("%v - %v", lstart.Local().Format("02.01."), hstop.Local().Format("02.01.2006"))
//duration = fmt.Sprintf("%v - %v",lstart.Local().Format("01.02.2006"),hstop.Local().Format("01.02.2006"))
return
}
@@ -908,6 +925,7 @@ func showStatus(full bool) {
showOpenProject(true)
if full {
+ ShowProjectSum()
getClosedTasks(0)
}
@@ -929,6 +947,14 @@ func showStatus(full bool) {
*/
}
+// Get all Tasks of the current Project and display them with simmilar name
+func ShowProjectSum() {
+ _,st := GetTaskSums(currproject.id)
+ fmt.Println(sub("Tasks"))
+ fmt.Println(StrLines(st,nli))
+ fmt.Println(sub(""))
+}
+
func showCurrentTask() {
if opentask.id == 0 {
if pausetask > 0 {
@@ -1577,6 +1603,33 @@ func editProject(id int) {
fmt.Println(frame("",false))
}
+func PromptColor(col int) (mastercol *color.Color){
+ boldBlue := color.New(color.FgBlue, color.Bold)//.SprintFunc()
+ boldRed := color.New(color.FgRed, color.Bold)//.SprintFunc()
+ boldMag := color.New(color.FgMagenta, color.Bold)//.SprintFunc()
+ boldCyan := color.New(color.FgCyan, color.Bold)//.SprintFunc()
+ boldGreen := color.New(color.FgGreen, color.Bold)//.SprintFunc()
+ boldYell := color.New(color.FgYellow, color.Bold)//.SprintFunc()
+ //boldCol := color.New(color.FgYellow, color.Bold).SprintFunc()
+
+ SetColor(col)
+ switch col {
+ case 0:
+ mastercol = boldMag
+ case 1:
+ mastercol = boldBlue
+ case 2:
+ mastercol = boldCyan
+ case 3:
+ mastercol = boldGreen
+ case 4:
+ mastercol = boldYell
+ case 5:
+ mastercol = boldRed
+ }
+ return
+}
+
func isBill(id int) bool {
rows, err := db.Query("SELECT * FROM bills WHERE id = $1", id)