Plugin cloning via menu (#6433)
* Add plugin cloning via menu * Split plugin commands by action * Keep plugin enablement in action commands * Remove unused plugin edit command * Simplify plugin rescan arguments * Assume Omarchy shell is running for plugin commands * Remove plugin compatibility dispatcher * Flatten plugin clone command * Keep only shared plugin helpers * Remove plugin rescan wrapper * Keep plugin commands self-contained * Simplify plugin clone lifecycle
This commit is contained in:
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Enable a shell plugin
|
||||
# omarchy:group=plugin
|
||||
# omarchy:args=<id> [placement]
|
||||
# omarchy:examples=omarchy plugin enable acme.weather --section right
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
fail() {
|
||||
echo "omarchy-plugin-enable: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ ${1:-} == "-h" || ${1:-} == "--help" ]]; then
|
||||
echo "Usage: omarchy plugin enable <id> [placement]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
id="${1:-}"
|
||||
[[ -n $id ]] || fail "plugin id is required"
|
||||
shift
|
||||
|
||||
if (( $# > 0 )) && omarchy-plugin-catalog | jq -e --arg id "$id" '
|
||||
any(.[]; .id == $id and (.kinds | index("bar")))
|
||||
' >/dev/null; then
|
||||
fail "'$id' is a bar; it replaces the bar in use rather than taking a place in one"
|
||||
fi
|
||||
|
||||
result=$(omarchy-shell shell setPluginEnabled "$id" true)
|
||||
[[ $result == "ok" ]] ||
|
||||
fail "plugin '$id' is not known; run: omarchy-shell shell rescanPlugins"
|
||||
|
||||
if (( $# > 0 )); then
|
||||
omarchy-bar-plugin move "$id" "$@"
|
||||
echo "Enabled and moved $id"
|
||||
elif omarchy-plugin-catalog | jq -e --arg id "$id" '
|
||||
any(.[]; .id == $id and (.kinds | index("bar")))
|
||||
' >/dev/null; then
|
||||
echo "Now using $id as the bar"
|
||||
else
|
||||
echo "Enabled $id"
|
||||
fi
|
||||
Reference in New Issue
Block a user