-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscriptable.sh
executable file
·37 lines (29 loc) · 905 Bytes
/
scriptable.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
#!/bin/bash
function show_commands() {
echo "Available commands: '$1'"
printf '\r\n'
printf ' '
printf '%s\n ' "${commands[@]}"
printf '\r\n'
}
function upgradeTypes() {
curl https://raw.githubusercontent.com/schl3ck/ios-scriptable-types/master/dist/scriptable.d.ts -o index.d.ts
}
function init() {
ln -s ~/Library/Mobile\ Documents/iCloud~dk~simonbs~Scriptable/Documents/ sources
}
function import() {
ln ~/Library/Mobile\ Documents/iCloud~dk~simonbs~Scriptable/Documents/"$1.js" "widgets/$1.js"
}
function importModule() {
ln ~/Library/Mobile\ Documents/iCloud~dk~simonbs~Scriptable/Documents/modules/"$1.js" "modules/$1.js"
}
function list() {
ls ~/Library/Mobile\ Documents/iCloud~dk~simonbs~Scriptable/Documents/
}
commands=(init list import importModule upgradeTypes)
if [[ $# -gt 0 ]] && [[ "${commands[@]}" =~ "$1" ]]; then
$1 "${@:2}";
else
show_commands "$commands"
fi