Skip to content

Commit

Permalink
improve some extension
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Nov 13, 2023
1 parent 00a300e commit 8fc45c8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 5 additions & 4 deletions extensions/oneliners.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,23 @@ if [ "$COMMAND" = "list" ]; then
title: .value.title,
subtitle: .value.command,
actions: [
{ title: "Run Oneliner", type: "run", command: "run", params: { index: .key }, exit: (.value.exit // false) },
{ title: "Copy Command", key: "c", type: "copy", text: .value.command, exit: true },
{ title: "Edit Oneliner", key: "e", type: "run", "command": "edit", params: {
{ title: "Edit Oneliner", type: "run", "command": "edit", params: {
index: .key,
title: { default: .value.title },
command: { default: .value.command },
exit: { default: (.value.exit // false) }
}, reload: true},
{ title: "Copy Command", key: "c", type: "copy", text: .value.command, exit: true },
{ title: "Run Oneliner", key: "r", type: "run", command: "run", params: { index: .key }, exit: (.value.exit // false) },
{ title: "Delete Oneliner", key: "d", type: "run", command: "delete", params: { index: .key }, reload: true },
{ title: "Create Oneliner", key: "n", type: "run", command: "create", reload: true }
]
})
}' "$CONFIG_PATH"
elif [ "$COMMAND" = "run" ]; then
INDEX=$(echo "$1" | sunbeam query -r ".params.index")
sunbeam query -r ".oneliners[$INDEX].command" "$CONFIG_PATH" | sh
ONELINER_COMMAND=$(sunbeam query -r ".oneliners[$INDEX].command" "$CONFIG_PATH")
sh -c "$ONELINER_COMMAND"
elif [ "$COMMAND" = "delete" ]; then
INDEX=$(echo "$1" | sunbeam query -r ".params.index")
# shellcheck disable=SC2016
Expand Down
7 changes: 7 additions & 0 deletions extensions/rss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ if (payload.command == "list") {
params: {
url
},
},
{
title: "Copy URL",
type: "copy",
key: "c",
text: url,
exit: true
}
]
})),
Expand Down
1 change: 1 addition & 0 deletions extensions/tldr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ if [ $# -eq 0 ]; then
{
title: "Browse TLDR Pages",
description: "Browse TLDR Pages",
root: [{command: "list"}],
requirements: [
{ name: "tldr", link: "https://dbrgn.github.io/tealdeer/installing.html" }
],
Expand Down

0 comments on commit 8fc45c8

Please sign in to comment.