2
2
3
3
set -euo pipefail
4
4
5
- EXTENSIONS_DIR=" ${SUNBEAM_EXTENSIONS_DIR:- $HOME / .config/ sunbeam/ extensions} "
6
5
7
6
if [ $# -eq 0 ]; then
8
- jq -n --arg dir " $EXTENSIONS_DIR " ' {
7
+ jq -n ' {
9
8
title: "Sunbeam",
10
9
actions: [
11
- { title: "Search Extensions", type: "run", command: "ls" },
12
- { title: "Open Extensions Dir", type: "open", target: $dir }
10
+ { title: "Search Extensions", type: "run", command: "ls" }
13
11
],
14
12
commands: [
15
13
{ name: "ls", mode: "filter" },
@@ -23,18 +21,18 @@ COMMAND=$1
23
21
PARAMS=$( cat)
24
22
25
23
if [ " $COMMAND " = " ls" ]; then
26
- find " $EXTENSIONS_DIR " -type f -or -type l | jq --arg dir " $EXTENSIONS_DIR " -R ' {
27
- title: (. | split("/") | last) ,
24
+ sunbeam | jq ' .[] | {
25
+ title: .name ,
28
26
accessories: [
29
- .
27
+ .entrypoint
30
28
],
31
29
actions: [
32
- { title: "Open extension", type: "open", target: . },
33
- { title: "Copy Path", type: "copy", text: . },
34
- { title: "Remove Extension", type: "run", command: "rm", params: { path: . }, reload: true }
30
+ { title: "Open extension", type: "open", target: .entrypoint },
31
+ { title: "Copy Path", type: "copy", text: .entrypoint },
32
+ { title: "Remove Extension", type: "run", command: "rm", params: { path: .entrypoint }, reload: true }
35
33
]
36
34
}' | jq -s ' { items: . }'
37
35
elif [ " $COMMAND " = " rm" ]; then
38
36
EXTENSION_PATH=$( jq -r ' .path' <<< " $PARAMS" )
39
- rm -r " $EXTENSION_PATH "
37
+ rm " $EXTENSION_PATH "
40
38
fi
0 commit comments