Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 38 additions & 7 deletions bin/omarchy
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ GROUP_DESCRIPTIONS[brightness]="Display and keyboard brightness"
GROUP_DESCRIPTIONS[camera]="Webcam relay and image tuning"
GROUP_DESCRIPTIONS[capture]="Screenshots and screen recording"
GROUP_DESCRIPTIONS[channel]="Omarchy release channel management"
GROUP_DESCRIPTIONS[clipboard]="Clipboard helpers"
GROUP_DESCRIPTIONS[cmd]="Command and shortcut helpers"
GROUP_DESCRIPTIONS[config]="System configuration helpers"
GROUP_DESCRIPTIONS[crash]="Crash notification controls"
Expand All @@ -53,6 +52,7 @@ GROUP_DESCRIPTIONS[dictation]="Dictation recording"
GROUP_DESCRIPTIONS[display]="Display and text scaling"
GROUP_DESCRIPTIONS[dns]="DNS resolver configuration"
GROUP_DESCRIPTIONS[dock]="Dock shown on floating workspaces"
GROUP_DESCRIPTIONS[doctor]="Health check of this Omarchy install, with a next step for each failure"
GROUP_DESCRIPTIONS[drive]="Drive selection and encryption"
GROUP_DESCRIPTIONS[file]="File selection helpers"
GROUP_DESCRIPTIONS[font]="Font management"
Expand All @@ -63,12 +63,12 @@ GROUP_DESCRIPTIONS[hw]="Hardware detection"
GROUP_DESCRIPTIONS[hyprland]="Hyprland window, monitor, and toggle controls"
GROUP_DESCRIPTIONS[icons]="App icon set management"
GROUP_DESCRIPTIONS[install]="Optional software installers"
GROUP_DESCRIPTIONS[installed]="Installed optional service checks"
GROUP_DESCRIPTIONS[launch]="Application launchers"
GROUP_DESCRIPTIONS[kernel]="Default boot kernel selection"
GROUP_DESCRIPTIONS[language]="Display language and system locale"
GROUP_DESCRIPTIONS[menu]="Omarchy menu commands"
GROUP_DESCRIPTIONS[migrate]="Migration runner"
GROUP_DESCRIPTIONS[mode]="Desktop modes that set several settings at once and put them back"
GROUP_DESCRIPTIONS[monitor]="Monitor status helpers"
GROUP_DESCRIPTIONS[network]="Network, Wi-Fi, and Ethernet controls"
GROUP_DESCRIPTIONS[notification]="Notification helpers"
Expand Down Expand Up @@ -650,14 +650,45 @@ group_has_binary_commands() {
command_requires_args() {
local key="$1"
local args="${COMMAND_ARGS[$key]}"
local required="$args"
local segment=""
local segments=()
local depth=0
local i=0
local char=""

# A top-level | separates alternatives, and any one of them can satisfy the
# command: a bare invocation is only missing an argument when every
# alternative needs one. Pipes inside [], () or <> belong to one alternative.
for ((i = 0; i < ${#args}; i++)); do
char="${args:i:1}"
case "$char" in
'[' | '(' | '<') depth=$((depth + 1)) ;;
']' | ')' | '>')
if ((depth > 0)); then depth=$((depth - 1)); fi
;;
'|')
if ((depth == 0)); then
segments+=("$segment")
segment=""
continue
fi
;;
esac
segment+="$char"
done
segments+=("$segment")

while [[ $required =~ ^(.*)\[[^][]*\](.*)$ ]]; do
required="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
local required=""
for segment in "${segments[@]}"; do
required="$segment"
while [[ $required =~ ^(.*)\[[^][]*\](\.\.\.)?(.*)$ ]]; do
required="${BASH_REMATCH[1]}${BASH_REMATCH[3]}"
done
required="${required//[[:space:]]/}"
[[ -z $required ]] && return 1
done

required="${required// /}"
[[ -n $required ]]
return 0
}

# A command whose documented arguments are all flags can't take a word, so a
Expand Down
Loading
Loading