Files
archypr/scripts/dev-bin-metadata
T

90 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# archypr:summary=Show Omarchy bin metadata fields and defaults
# archypr:args=[--json]
set -euo pipefail
show_json() {
jq -n '{
ok: true,
defaults: {
group: "first filename segment after archypr-",
name: "remaining filename segments with dashes converted to spaces",
route: "omarchy <group> <name>",
binary: "filename",
requires_sudo: false
},
fields: [
{name: "summary", required: true, type: "string", note: "One-line human and agent-facing description."},
{name: "group", required: false, type: "string", note: "Only set when the route group should differ from the filename-derived group."},
{name: "name", required: false, type: "string", note: "Only set when the route name should differ from the filename-derived name. May be empty for root commands."},
{name: "args", required: false, type: "string", note: "Only set when the command accepts arguments."},
{name: "examples", required: false, type: "string", note: "Pipe-separated examples."},
{name: "aliases", required: false, type: "string", note: "Pipe-separated alternate routes, e.g. omarchy screenshot."},
{name: "requires-sudo", required: false, type: "true", default: false, note: "Only include when true."},
{name: "hidden", required: false, type: "true", default: false, note: "Hide from default command listings; visible with --all."}
]
}'
}
show_help() {
cat <<'EOF'
Omarchy bin metadata
Metadata lives in the top comment block of each executable bin/omarchy-* file.
Keep it slim: define only fields that are required or override defaults.
Required:
# archypr:summary=<one-line description>
Inferred defaults:
group first filename segment after archypr-
name remaining filename segments, with dashes converted to spaces
route omarchy <group> <name>
binary filename
requires-sudo false
hidden false
Optional fields:
# archypr:group=<group> route override only
# archypr:name=<name> route override only; may be empty
# archypr:args=<args> only if the command accepts args
# archypr:examples=<cmd> | <cmd> pipe-separated examples
# archypr:aliases=<route> | <route> pipe-separated alternate routes
# archypr:requires-sudo=true only when true
# archypr:hidden=true hide from default command listings
Do not define:
binary inferred from filename
usage derived from route + args
false flags or empty args
Examples:
# archypr:summary=Restart Walker and related user services
# archypr:summary=Take a screenshot
# archypr:group=capture
# archypr:args=[smart|region|windows|fullscreen] [slurp|copy] [--editor=<name>]
# archypr:examples=omarchy screenshot | omarchy capture screenshot region
# archypr:aliases=omarchy screenshot
EOF
}
case "${1:-}" in
--json)
show_json
;;
--help | -h)
show_help
;;
"")
show_help
;;
*)
echo "Unknown option: $1" >&2
show_help >&2
exit 2
;;
esac