Remove dead code from plugin scripts
canonical_widget_id was a pure pass-through, making its reserved-id check a tautology; require_omarchy_path and choose_value were defined but never called. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ad8ab1a7fa
commit
6f6c991936
@@ -54,10 +54,6 @@ fail() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_omarchy_path() {
|
||||
[[ -n ${OMARCHY_PATH:-} ]] || fail "OMARCHY_PATH is not set"
|
||||
}
|
||||
|
||||
require_command() {
|
||||
command -v "$1" >/dev/null 2>&1 || fail "$1 is required"
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ interactive() {
|
||||
[[ -t 0 && -t 1 ]]
|
||||
}
|
||||
|
||||
canonical_widget_id() {
|
||||
printf '%s' "$1"
|
||||
}
|
||||
|
||||
slug_id() {
|
||||
tr '[:upper:]' '[:lower:]' <<<"$1" | sed -E 's/^omarchy\.//; s/[^a-z0-9]+/-/g; s/^-+//; s/-+$//'
|
||||
}
|
||||
@@ -39,7 +35,6 @@ validate_plugin_id() {
|
||||
[[ $id =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]] || fail "plugin id must contain only letters, numbers, dots, underscores, and dashes"
|
||||
[[ $id == *.* ]] || fail "plugin id must be namespaced, e.g. local.clock"
|
||||
[[ $id != omarchy.* ]] || fail "plugin ids beginning with omarchy. are reserved for built-ins"
|
||||
[[ $(canonical_widget_id "$id") == "$id" ]] || fail "$id is a reserved built-in widget id"
|
||||
}
|
||||
|
||||
catalog_json() {
|
||||
@@ -52,10 +47,7 @@ catalog_json() {
|
||||
# built-in bar widget matching $1 (by id or alias). Used to find the source QML
|
||||
# file and metadata to copy when cloning a widget.
|
||||
builtin_widget_info() {
|
||||
local wanted
|
||||
wanted=$(canonical_widget_id "$1")
|
||||
|
||||
catalog_json | jq -r --arg id "$wanted" '
|
||||
catalog_json | jq -r --arg id "$1" '
|
||||
.[] | select((.kinds | index("bar-widget")) and .barWidgetPath != null)
|
||||
| select(.id == $id or (((.barWidget.aliases // [])) | index($id)))
|
||||
| [.id, .barWidgetPath, (.barWidget.displayName // .name // .id), (.barWidget.category // "Plugin"), (if .barWidget.allowMultiple == true then "true" else "false" end)]
|
||||
@@ -78,12 +70,6 @@ choose_clone_source() {
|
||||
awk '{ print $NF }' <<<"$selected"
|
||||
}
|
||||
|
||||
choose_value() {
|
||||
local prompt="$1"
|
||||
shift
|
||||
gum choose --header "$prompt" "$@"
|
||||
}
|
||||
|
||||
input_value() {
|
||||
local prompt="$1"
|
||||
local value="${2:-}"
|
||||
@@ -286,7 +272,6 @@ clone_command() {
|
||||
fail "clone source is required"
|
||||
fi
|
||||
fi
|
||||
source_id=$(canonical_widget_id "$source_id")
|
||||
|
||||
local default_slug
|
||||
default_slug=$(slug_id "$source_id")
|
||||
|
||||
Reference in New Issue
Block a user