forked from naggie/dstask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconst.go
182 lines (165 loc) · 4.24 KB
/
const.go
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package dstask
import "os"
func init() {
if os.Getenv("DSTASK_FAKE_PTY") != "" {
FAKE_PTY = true
}
}
var (
// for CI testing
FAKE_PTY = false
// populated by linker flags, see do-release.sh
GIT_COMMIT = "Unknown"
VERSION = "Unknown"
BUILD_DATE = "Unknown"
)
const (
STATUS_PENDING = "pending"
STATUS_ACTIVE = "active"
STATUS_RESOLVED = "resolved"
STATUS_DELEGATED = "delegated"
STATUS_DEFERRED = "deferred"
STATUS_PAUSED = "paused"
STATUS_RECURRING = "recurring"
STATUS_TEMPLATE = "template"
CMD_NEXT = "next"
CMD_ADD = "add"
CMD_RM = "rm"
CMD_REMOVE = "remove"
CMD_TEMPLATE = "template"
CMD_LOG = "log"
CMD_START = "start"
CMD_NOTE = "note"
CMD_NOTES = "notes"
CMD_STOP = "stop"
CMD_DONE = "done"
CMD_RESOLVE = "resolve"
CMD_CONTEXT = "context"
CMD_MODIFY = "modify"
CMD_EDIT = "edit"
CMD_UNDO = "undo"
CMD_SYNC = "sync"
CMD_OPEN = "open"
CMD_GIT = "git"
CMD_SHOW_NEXT = "show-next"
CMD_SHOW_PROJECTS = "show-projects"
CMD_SHOW_TAGS = "show-tags"
CMD_SHOW_ACTIVE = "show-active"
CMD_SHOW_PAUSED = "show-paused"
CMD_SHOW_OPEN = "show-open"
CMD_SHOW_RESOLVED = "show-resolved"
CMD_SHOW_TEMPLATES = "show-templates"
CMD_SHOW_UNORGANISED = "show-unorganised"
CMD_COMPLETIONS = "_completions"
CMD_HELP = "help"
CMD_VERSION = "version"
//nolint
CMD_PRINT_ZSH_COMPLETION = "zsh-completion"
//nolint
CMD_PRINT_BASH_COMPLETION = "bash-completion"
//nolint
CMD_PRINT_FISH_COMPLETION = "fish-completion"
// filter: P1 P2 etc
PRIORITY_CRITICAL = "P0"
PRIORITY_HIGH = "P1"
PRIORITY_NORMAL = "P2"
PRIORITY_LOW = "P3"
MAX_TASKS_OPEN = 10000
TASK_FILENAME_LEN = 40
// if the terminal is too short, show this many tasks anyway
MIN_TASKS_SHOWN = 8
// reserve this many lines for status messages/prompt
TERMINAL_HEIGHT_MARGIN = 9
IGNORE_CONTEXT_KEYWORD = "--"
NOTE_MODE_KEYWORD = "/"
// theme loosely based on https://github.com/GothenburgBitFactory/taskwarrior/blob/2.6.0/doc/rc/dark-256.theme
TABLE_MAX_WIDTH = 160 // keep it readable
TABLE_COL_GAP = 2 // differentiate columns
MODE_HEADER = 4
FG_DEFAULT = 250
BG_DEFAULT_1 = 233
BG_DEFAULT_2 = 232
MODE_DEFAULT = 0
FG_ACTIVE = 233
BG_ACTIVE = 250
BG_PAUSED = 236 // task that has been started then stopped
FG_PRIORITY_CRITICAL = 160
FG_PRIORITY_HIGH = 166
FG_PRIORITY_NORMAL = FG_DEFAULT
FG_PRIORITY_LOW = 245
FG_NOTE = 240
)
// for import (etc) it's necessary to have full context
var ALL_STATUSES = []string{
STATUS_ACTIVE,
STATUS_PENDING,
STATUS_DELEGATED,
STATUS_DEFERRED,
STATUS_PAUSED,
STATUS_RECURRING,
STATUS_RESOLVED,
STATUS_TEMPLATE,
}
// statuses which are hidden by default (direct addressing or show- commands
// needed to see them)
var HIDDEN_STATUSES = []string{
STATUS_RECURRING,
STATUS_RESOLVED,
STATUS_TEMPLATE,
}
// incomplete until all statuses are implemented
var VALID_STATUS_TRANSITIONS = [][]string{
{STATUS_PENDING, STATUS_ACTIVE},
{STATUS_ACTIVE, STATUS_PAUSED},
{STATUS_PAUSED, STATUS_ACTIVE},
{STATUS_PENDING, STATUS_RESOLVED},
{STATUS_PAUSED, STATUS_RESOLVED},
{STATUS_ACTIVE, STATUS_RESOLVED},
{STATUS_PENDING, STATUS_TEMPLATE},
}
// for most operations, it's not necessary or desirable to load the expensive resolved tasks
var NON_RESOLVED_STATUSES = []string{
STATUS_ACTIVE,
STATUS_PENDING,
STATUS_DELEGATED,
STATUS_DEFERRED,
STATUS_PAUSED,
STATUS_RECURRING,
STATUS_TEMPLATE,
}
var ALL_CMDS = []string{
CMD_NEXT,
CMD_ADD,
CMD_RM,
CMD_REMOVE,
CMD_TEMPLATE,
CMD_LOG,
CMD_START,
CMD_NOTE,
CMD_NOTES,
CMD_STOP,
CMD_DONE,
CMD_RESOLVE,
CMD_CONTEXT,
CMD_MODIFY,
CMD_EDIT,
CMD_UNDO,
CMD_SYNC,
CMD_OPEN,
CMD_GIT,
CMD_SHOW_NEXT,
CMD_SHOW_PROJECTS,
CMD_SHOW_TAGS,
CMD_SHOW_ACTIVE,
CMD_SHOW_PAUSED,
CMD_SHOW_OPEN,
CMD_SHOW_RESOLVED,
CMD_SHOW_TEMPLATES,
CMD_SHOW_UNORGANISED,
CMD_COMPLETIONS,
CMD_PRINT_BASH_COMPLETION,
CMD_PRINT_FISH_COMPLETION,
CMD_PRINT_ZSH_COMPLETION,
CMD_HELP,
CMD_VERSION,
}