aboutsummaryrefslogtreecommitdiff
path: root/workstack.go
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-12 13:05:02 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-10-12 13:05:02 +0200
commitb0397503c8bdcc98216bab220b661466c74a63e9 (patch)
tree01e0fb2b1b80ff197d533a72708a00621f70e3ac /workstack.go
parent98dd9ae0629d58b16603d0188bd7e6f6f182e337 (diff)
Create separate module for primitives
- Added a converter tool to convert from an old version of gobdata to a new format - added ws sub directory for the command line tool
Diffstat (limited to 'workstack.go')
-rw-r--r--workstack.go76
1 files changed, 76 insertions, 0 deletions
diff --git a/workstack.go b/workstack.go
new file mode 100644
index 0000000..1205039
--- /dev/null
+++ b/workstack.go
@@ -0,0 +1,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
+}