blob: 1205039e799b00d7c7e18b410dd46d458e71bbc7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
package workstack
// Workstack or ws for short is a program that manages To-Do's in a stack-based fashion. It tries
// to guide your focus to your three most important tasks such that you do not get distracted by
// other tasks.
// Every task added starts as inactive "[ ]" and can be marked as done by changing the status to
// "[x]".
// When the programs exits Tasks are saved to a tasks.gob file, this will truncate (os.Create) the
// existing file.
// TODO's
// - edit functionality
// - import: read multiple lines from stdin and import them as taks
// - parsing text as Tasks, maybe helper program?
// - clocking functionality with a 'task' command
// - testing:
// - [ ] add
// - [ ] done
// - [ ] undone
// - [ ] del
// - [ ] pc
// - [ ] <no arg>
// - [ ] ls
// - [ ] list
// - [ ] tag
// - [ ] tagd
// - [ ] tagl
import (
"fmt"
"os"
"time"
)
type TaskDone struct {
Task Task
Date time.Time
}
func (t TaskDone) String() string {
return fmt.Sprintf("(%s) %s", t.Date.Format(DateLayout), t.Task)
}
type Tag string
type Task struct {
Text string
Tag Tag
}
func (t Task) String() string {
if t.Tag != "" {
return fmt.Sprintf("{%s} %s", t.Tag, t.Text)
} else {
return fmt.Sprintf("%s", t.Text)
}
}
var (
// Persistent storage for Tasks
Gobdata string = "tasks.gob"
DateLayout string = "15:04:05 02/01/2006"
)
const (
TASK_LIST_COUNT = 5
GOBDATA_FILENAME = "tasks.gob"
)
func GetGobdataPath() string {
p := os.Getenv("HOME")
if p == "" {
panic("HOME var not set.")
}
return p + "/sync/share/" + GOBDATA_FILENAME
}
|