mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Hide certain commands from the list that aren't relevant to the vast majority
This commit is contained in:
+29
-8
@@ -17,6 +17,7 @@ declare -A COMMAND_USAGE
|
|||||||
declare -A COMMAND_ARGS
|
declare -A COMMAND_ARGS
|
||||||
declare -A COMMAND_EXAMPLES
|
declare -A COMMAND_EXAMPLES
|
||||||
declare -A COMMAND_REQUIRES_SUDO
|
declare -A COMMAND_REQUIRES_SUDO
|
||||||
|
declare -A COMMAND_HIDDEN
|
||||||
declare -A COMMAND_ALIASES
|
declare -A COMMAND_ALIASES
|
||||||
declare -A COMMAND_HAS_SUMMARY
|
declare -A COMMAND_HAS_SUMMARY
|
||||||
declare -A COMMAND_METADATA_ERRORS
|
declare -A COMMAND_METADATA_ERRORS
|
||||||
@@ -131,6 +132,7 @@ register_command() {
|
|||||||
local examples=""
|
local examples=""
|
||||||
local aliases=""
|
local aliases=""
|
||||||
local requires_sudo=""
|
local requires_sudo=""
|
||||||
|
local hidden=""
|
||||||
local line=""
|
local line=""
|
||||||
local metadata_key=""
|
local metadata_key=""
|
||||||
local metadata_value=""
|
local metadata_value=""
|
||||||
@@ -186,6 +188,10 @@ register_command() {
|
|||||||
requires_sudo="$metadata_value"
|
requires_sudo="$metadata_value"
|
||||||
[[ $metadata_value == "true" ]] || metadata_errors=$(append_pipe_value "$metadata_errors" "requires-sudo must be omitted or true")
|
[[ $metadata_value == "true" ]] || metadata_errors=$(append_pipe_value "$metadata_errors" "requires-sudo must be omitted or true")
|
||||||
;;
|
;;
|
||||||
|
hidden)
|
||||||
|
hidden="$metadata_value"
|
||||||
|
[[ $metadata_value == "true" ]] || metadata_errors=$(append_pipe_value "$metadata_errors" "hidden must be omitted or true")
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -229,6 +235,7 @@ register_command() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
[[ $requires_sudo == "true" ]] || requires_sudo="false"
|
[[ $requires_sudo == "true" ]] || requires_sudo="false"
|
||||||
|
[[ $hidden == "true" ]] || hidden="false"
|
||||||
|
|
||||||
local key="$file_binary"
|
local key="$file_binary"
|
||||||
COMMAND_KEYS+=("$key")
|
COMMAND_KEYS+=("$key")
|
||||||
@@ -242,6 +249,7 @@ register_command() {
|
|||||||
COMMAND_ARGS["$key"]="$args"
|
COMMAND_ARGS["$key"]="$args"
|
||||||
COMMAND_EXAMPLES["$key"]="$examples"
|
COMMAND_EXAMPLES["$key"]="$examples"
|
||||||
COMMAND_REQUIRES_SUDO["$key"]="$requires_sudo"
|
COMMAND_REQUIRES_SUDO["$key"]="$requires_sudo"
|
||||||
|
COMMAND_HIDDEN["$key"]="$hidden"
|
||||||
COMMAND_HAS_SUMMARY["$key"]="$has_summary"
|
COMMAND_HAS_SUMMARY["$key"]="$has_summary"
|
||||||
COMMAND_METADATA_ERRORS["$key"]="$metadata_errors"
|
COMMAND_METADATA_ERRORS["$key"]="$metadata_errors"
|
||||||
|
|
||||||
@@ -377,6 +385,9 @@ sorted_keys() {
|
|||||||
local key=""
|
local key=""
|
||||||
|
|
||||||
for key in "${COMMAND_KEYS[@]}"; do
|
for key in "${COMMAND_KEYS[@]}"; do
|
||||||
|
if [[ $include_all != "true" && ${COMMAND_HIDDEN[$key]} == "true" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
printf '%s\t%s\n' "${COMMAND_ROUTE[$key]}" "$key"
|
printf '%s\t%s\n' "${COMMAND_ROUTE[$key]}" "$key"
|
||||||
done | sort -u | cut -f2-
|
done | sort -u | cut -f2-
|
||||||
}
|
}
|
||||||
@@ -420,6 +431,10 @@ sorted_group_keys() {
|
|||||||
local route=""
|
local route=""
|
||||||
|
|
||||||
for key in "${COMMAND_KEYS[@]}"; do
|
for key in "${COMMAND_KEYS[@]}"; do
|
||||||
|
if [[ $include_all != "true" && ${COMMAND_HIDDEN[$key]} == "true" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
fallback_group=$(fallback_group_for_key "$key")
|
fallback_group=$(fallback_group_for_key "$key")
|
||||||
if [[ ${COMMAND_GROUP[$key]} != "$group" && $fallback_group != "$group" ]]; then
|
if [[ ${COMMAND_GROUP[$key]} != "$group" && $fallback_group != "$group" ]]; then
|
||||||
continue
|
continue
|
||||||
@@ -510,7 +525,7 @@ Usage:
|
|||||||
List commands known to the Omarchy command center.
|
List commands known to the Omarchy command center.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--all Accepted for compatibility
|
--all Include commands explicitly marked hidden
|
||||||
--json Emit machine-readable JSON
|
--json Emit machine-readable JSON
|
||||||
--markdown Emit a Markdown command table
|
--markdown Emit a Markdown command table
|
||||||
--check Validate command metadata and route collisions
|
--check Validate command metadata and route collisions
|
||||||
@@ -562,6 +577,9 @@ show_commands() {
|
|||||||
|
|
||||||
for route in "${!ROUTE_IS_ALIAS[@]}"; do
|
for route in "${!ROUTE_IS_ALIAS[@]}"; do
|
||||||
key="${ROUTE_TO_KEY[$route]}"
|
key="${ROUTE_TO_KEY[$route]}"
|
||||||
|
if [[ $include_all != "true" && ${COMMAND_HIDDEN[$key]} == "true" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
alias_rows+="$route"$'\t'"${COMMAND_ROUTE[$key]}"$'\n'
|
alias_rows+="$route"$'\t'"${COMMAND_ROUTE[$key]}"$'\n'
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -600,13 +618,14 @@ emit_command_records() {
|
|||||||
|
|
||||||
while IFS= read -r key; do
|
while IFS= read -r key; do
|
||||||
[[ -n $key ]] || continue
|
[[ -n $key ]] || continue
|
||||||
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
|
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
|
||||||
"${COMMAND_ROUTE[$key]}" \
|
"${COMMAND_ROUTE[$key]}" \
|
||||||
"${COMMAND_BINARY[$key]}" \
|
"${COMMAND_BINARY[$key]}" \
|
||||||
"${COMMAND_GROUP[$key]}" \
|
"${COMMAND_GROUP[$key]}" \
|
||||||
"${COMMAND_NAME[$key]}" \
|
"${COMMAND_NAME[$key]}" \
|
||||||
"${COMMAND_SUMMARY[$key]}" \
|
"${COMMAND_SUMMARY[$key]}" \
|
||||||
"${COMMAND_REQUIRES_SUDO[$key]}" \
|
"${COMMAND_REQUIRES_SUDO[$key]}" \
|
||||||
|
"${COMMAND_HIDDEN[$key]}" \
|
||||||
"${COMMAND_ARGS[$key]}" \
|
"${COMMAND_ARGS[$key]}" \
|
||||||
"${COMMAND_EXAMPLES[$key]}" \
|
"${COMMAND_EXAMPLES[$key]}" \
|
||||||
"${COMMAND_ALIASES[$key]}" \
|
"${COMMAND_ALIASES[$key]}" \
|
||||||
@@ -624,11 +643,12 @@ commands_json_filter() {
|
|||||||
name: .[3],
|
name: .[3],
|
||||||
summary: .[4],
|
summary: .[4],
|
||||||
requires_sudo: (.[5] == "true"),
|
requires_sudo: (.[5] == "true"),
|
||||||
args: .[6],
|
hidden: (.[6] == "true"),
|
||||||
examples: (.[7] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))),
|
args: .[7],
|
||||||
aliases: (.[8] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))),
|
examples: (.[8] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))),
|
||||||
filename_route: .[9],
|
aliases: (.[9] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))),
|
||||||
routes: ([.[0], .[9]] + (.[8] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))) | unique)
|
filename_route: .[10],
|
||||||
|
routes: ([.[0], .[10]] + (.[9] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))) | unique)
|
||||||
}] | {ok: true, commands: .}
|
}] | {ok: true, commands: .}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -682,13 +702,14 @@ show_command_json() {
|
|||||||
local key="$1"
|
local key="$1"
|
||||||
|
|
||||||
printf '%s\n' "$key" | while IFS= read -r key; do
|
printf '%s\n' "$key" | while IFS= read -r key; do
|
||||||
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
|
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
|
||||||
"${COMMAND_ROUTE[$key]}" \
|
"${COMMAND_ROUTE[$key]}" \
|
||||||
"${COMMAND_BINARY[$key]}" \
|
"${COMMAND_BINARY[$key]}" \
|
||||||
"${COMMAND_GROUP[$key]}" \
|
"${COMMAND_GROUP[$key]}" \
|
||||||
"${COMMAND_NAME[$key]}" \
|
"${COMMAND_NAME[$key]}" \
|
||||||
"${COMMAND_SUMMARY[$key]}" \
|
"${COMMAND_SUMMARY[$key]}" \
|
||||||
"${COMMAND_REQUIRES_SUDO[$key]}" \
|
"${COMMAND_REQUIRES_SUDO[$key]}" \
|
||||||
|
"${COMMAND_HIDDEN[$key]}" \
|
||||||
"${COMMAND_ARGS[$key]}" \
|
"${COMMAND_ARGS[$key]}" \
|
||||||
"${COMMAND_EXAMPLES[$key]}" \
|
"${COMMAND_EXAMPLES[$key]}" \
|
||||||
"${COMMAND_ALIASES[$key]}" \
|
"${COMMAND_ALIASES[$key]}" \
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Designed to be run by systemd timer every 30 seconds and alerts if battery is low
|
# omarchy:summary=Designed to be run by systemd timer every 30 seconds and alerts if battery is low
|
||||||
|
# omarchy:hidden=true
|
||||||
|
|
||||||
BATTERY_THRESHOLD=10
|
BATTERY_THRESHOLD=10
|
||||||
NOTIFICATION_FLAG="/run/user/$UID/omarchy_battery_notified"
|
NOTIFICATION_FLAG="/run/user/$UID/omarchy_battery_notified"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Print the current working directory of the active terminal window
|
# omarchy:summary=Print the current working directory of the active terminal window
|
||||||
|
# omarchy:hidden=true
|
||||||
|
|
||||||
terminal_pid=$(hyprctl activewindow | awk '/pid:/ {print $2}')
|
terminal_pid=$(hyprctl activewindow | awk '/pid:/ {print $2}')
|
||||||
shell_pid=$(pgrep -P "$terminal_pid" | tail -n1)
|
shell_pid=$(pgrep -P "$terminal_pid" | tail -n1)
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ show_json() {
|
|||||||
{name: "args", required: false, type: "string", note: "Only set when the command accepts arguments."},
|
{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: "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: "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: "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."}
|
||||||
]
|
]
|
||||||
}'
|
}'
|
||||||
}
|
}
|
||||||
@@ -43,6 +44,7 @@ Inferred defaults:
|
|||||||
route omarchy <group> <name>
|
route omarchy <group> <name>
|
||||||
binary filename
|
binary filename
|
||||||
requires-sudo false
|
requires-sudo false
|
||||||
|
hidden false
|
||||||
|
|
||||||
Optional fields:
|
Optional fields:
|
||||||
# omarchy:group=<group> route override only
|
# omarchy:group=<group> route override only
|
||||||
@@ -51,6 +53,7 @@ Optional fields:
|
|||||||
# omarchy:examples=<cmd> | <cmd> pipe-separated examples
|
# omarchy:examples=<cmd> | <cmd> pipe-separated examples
|
||||||
# omarchy:aliases=<route> | <route> pipe-separated alternate routes
|
# omarchy:aliases=<route> | <route> pipe-separated alternate routes
|
||||||
# omarchy:requires-sudo=true only when true
|
# omarchy:requires-sudo=true only when true
|
||||||
|
# omarchy:hidden=true hide from default command listings
|
||||||
|
|
||||||
Do not define:
|
Do not define:
|
||||||
binary inferred from filename
|
binary inferred from filename
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Install Zed Editor and omazed to use the current Omarchy theme.
|
# omarchy:summary=Install Zed Editor and configure it with the current Omarchy theme
|
||||||
|
|
||||||
echo "Installing Zed Editor..."
|
echo "Installing Zed Editor..."
|
||||||
omarchy-pkg-add zed omazed
|
omarchy-pkg-add zed omazed
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
# omarchy:summary=Generate a theme's colors.toml from its alacritty.toml palette
|
# omarchy:summary=Generate a theme's colors.toml from its alacritty.toml palette
|
||||||
# omarchy:args=<theme-dir>
|
# omarchy:args=<theme-dir>
|
||||||
|
# omarchy:hidden=true
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Apply the current theme keyboard color to ASUS ROG keyboards
|
# omarchy:summary=Apply the current theme keyboard color to ASUS ROG keyboards
|
||||||
|
# omarchy:hidden=true
|
||||||
|
|
||||||
ASUSCTL_THEME=~/.config/omarchy/current/theme/keyboard.rgb
|
ASUSCTL_THEME=~/.config/omarchy/current/theme/keyboard.rgb
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Apply the current theme keyboard color to Framework Laptop 16 keyboards
|
# omarchy:summary=Apply the current theme keyboard color to Framework Laptop 16 keyboards
|
||||||
|
# omarchy:hidden=true
|
||||||
|
|
||||||
FRAMEWORK16_THEME=~/.config/omarchy/current/theme/keyboard.rgb
|
FRAMEWORK16_THEME=~/.config/omarchy/current/theme/keyboard.rgb
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user