blob: 17240a33438969d037ca85c7eac9772e72391114 (
plain)
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
|
function taskwarrior::fuzzy::_select
sed -n '/^[0-9]/p' | sort -rn | fzf | cut -d' ' -f1
end
function taskwarrior::fuzzy::find
set -g TASK_ID (task ready | taskwarrior::fuzzy::_select)
end
function taskwarrior::select
set -l task_id "$argv[1]"
if test -n "$task_id"
set -g TASK_ID "$task_id"
end
if test "$TASK_ID" = - -o -z "$TASK_ID"
taskwarrior::fuzzy::find
end
end
function taskwarrior::due::count
set -l due_count (task status:pending due.before:now count)
if test $due_count -gt 0
echo "There are $due_count tasks due!"
end
end
function taskwarrior::add::track
if test (count $argv) -gt 0
task add priority:L +personal +track $argv
else
tasksamurai +track
end
end
function taskwarrior::add::standup
if test (count $argv) -gt 0
task add priority:L +work +standup +sre +nosched $argv
task add priority:L +work +standup +storage +nosched $argv
if test -f ~/git/helpers/jira/jira.rb
echo "Do you want to raise a Jira ticket? (y/n)"
read -l user_input
if test "$user_input" = y
ruby ~/git/helpers/jira/jira.rb --raise "$argv"
end
end
else
tasksamurai +standup
end
end
function taskwarrior::add::standup::editor
set -l tmpfile (mktemp /tmp/standup.XXXXXX.txt)
$EDITOR $tmpfile
taskwarrior::add::standup (cat $tmpfile)
end
function _taskwarrior::set_import_export_tags
if test (uname) = Darwin
set -gx TASK_IMPORT_TAG work
set -gx TASK_EXPORT_TAG personal
else
set -gx TASK_IMPORT_TAG personal
set -gx TASK_EXPORT_TAG work
end
end
function taskwarrior::export::bd
if test -d ~/Notes/Bulgarian
# Export bulgarian dumi
set -l outfile ~/Notes/Bulgarian/bd-(date +%s).txt
task +bd status:pending export | jq -r '.[].description' >$outfile
yes | task +bd status:pending delete
cat ~/Notes/Bulgarian/bd-*.txt | sort -u >~/Notes/Bulgarian/compact-(date +%s).tmp && rm ~/Notes/Bulgarian/bd-*.txt
sort -u ~/Notes/Bulgarian/compact-*.tmp >~/Notes/Bulgarian/bd-compacted.txt && rm ~/Notes/Bulgarian/compact-*.tmp
end
end
function taskwarrior::export::gos
task +share status:pending export >"$WORKTIME_DIR/tw-gos-export-$(date +%s).json"
yes | task +share status:pending delete
end
function taskwarrior::export
_taskwarrior::set_import_export_tags
set -l count (task +$TASK_EXPORT_TAG status:pending count)
if test $count -eq 0
return
end
echo "Exporting $count tasks to $TASK_EXPORT_TAG"
task +$TASK_EXPORT_TAG status:pending export >"$WORKTIME_DIR/tw-$TASK_EXPORT_TAG-export-$(date +%s).json"
yes | task +$TASK_EXPORT_TAG status:pending delete
end
function taskwarrior::import
_taskwarrior::set_import_export_tags
find $WORKTIME_DIR -name "tw-$TASK_IMPORT_TAG-export-*.json" | while read -l import
task import $import
rm $import
end
find $WORKTIME_DIR -name "tw-(hostname)-export-*.json" | while read -l import
task import $import
rm $import
end
end
function taskwarrior::db::prune
yes | task +random status:completed delete
end
function taskwarrior::invoke
if test -f ~/scripts/taskwarriorfeeder.rb
ruby ~/scripts/taskwarriorfeeder.rb
end
tasksamurai
end
abbr -a t task
abbr -a L 'task add +log'
abbr -a tlog 'task add +log'
abbr -a log 'task add +log'
abbr -a tdue 'tasksamurai status:pending due.before:now'
abbr -a thome 'tasksamurai +home'
abbr -a tasks 'tasksamurai -track'
abbr -a tread 'tasksamurai +read'
abbr -a track 'taskwarrior::add::track'
abbr -a tra 'taskwarrior::add::track'
abbr -a trat 'timr track'
abbr -a tfind 'taskwarrior::fuzzy::find'
abbr -a ts 'taskwarrior::invoke'
# Virtual standup abbrs
abbr -a V 'taskwarrior::add::standup'
abbr -a Vstorage 'tasksamurai +standup +storage'
abbr -a Vsre 'tasksamurai +standup +sre'
abbr -a Ved 'taskwarrior::add::standup::editor'
taskwarrior::due::count
|