-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.sh
31 lines (30 loc) · 888 Bytes
/
functions.sh
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
# reset a job (remove the tag file) for an evry job
job-reset() {
local data_dir tags
if [[ -z "$1" ]] || [[ -n "$JOB_RESET_USE_FZF" ]]; then
data_dir="$(evry location - 2>/dev/null)"
cd "${data_dir}" || return $?
if tags="$(fzf -q "$*" -m)"; then
echo -e "$tags" | while read -r tag; do
command rm -v "${tag}"
done
else
# user didn't select something with fzf, cd back to dir and fail
cd - >/dev/null || return $?
return 1
fi
cd - || return
else
tag="$(evry location -"$1")"
if [[ -f "${tag}" ]]; then
command rm -v "${tag}"
else
echo "No such tag file: ${tag}" >&2
JOB_RESET_USE_FZF=1 job-reset "$1" || return $?
fi
fi
}
# pipe EVRY_JSON=1 json to this to describe when items run next
describe-evry-json() {
jq -r '.[] | select((.type == "tag_name") or .type == "till_next_pretty") | .body' | paste -d " " - - | sed -e 's/ / - /'
}