-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.sh
executable file
·51 lines (49 loc) · 957 Bytes
/
helper.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
#shellcheck disable=SC2154
case $HNS_ACTION in
clear_cache)
mkdir -p "${alfred_workflow_cache}"
if find "${alfred_workflow_cache:?}" -type f -delete >/dev/null ; then
cat <<-EOJ
{
"items": [
{
"title": "Cache has been cleared!",
"subtitle": "press ↵ to restart workflow",
"icon": { "path": "icons/trash.png" }
}
]
}
EOJ
exit 0
fi
;;
install_cli)
if ln -sf "$PWD/hn.sh" "$HNS_CLI_FQPN" &>/dev/null ; then
cat <<-EOJ
{
"items": [
{
"title": "Commandline tool installed → ${HNS_CLI_FQPN}",
"subtitle": "press ↵ to restart workflow",
"icon": { "path": "icons/cli.png" }
}
]
}
EOJ
exit 0
fi
;;
esac
cat <<EOJ
{
"items": [
{
"title": "Something went wrong!",
"subtitle": "Check the Debugger output for more detail",
"icon": { "path": "icons/gray.png" },
"valid": "false"
}
]
}
EOJ