Skip to content

Commit

Permalink
mount-helper/fs-realpath: fix regression from 4e41595
Browse files Browse the repository at this point in the history
also apply consistent boolean flag conventions
  • Loading branch information
balupton committed Sep 1, 2023
1 parent ed15743 commit a4814c2
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 123 deletions.
6 changes: 3 additions & 3 deletions commands/brew-installed
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ function brew_installed() (
'--help' | '-h') help ;;
'--formula' | '--formulae') brew_type='formula' ;;
'--cask' | '--casks') brew_type='cask' ;;
'--no-requested'* | '--requested'*) requested="$(
get-flag-value requested --missing="$requested" -- "$item" | echo-affirmative
)" ;;
'--no-requested'* | '--requested'*)
requested="$(get-flag-value requested --missing="$requested" -- "$item" | echo-affirmative)"
;;
'--')
packages+=("$@")
shift $#
Expand Down
12 changes: 6 additions & 6 deletions commands/choose-menu
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ function choose_menu() (
'--help' | '-h') help ;;
'--question='*) option_question="${item#*--question=}" ;;
'--timeout='*) option_timeout="${item#*--timeout=}" ;;
'--no-multi'* | '--multi'*) option_multi="$(
get-flag-value multi --missing="$option_multi" -- "$item" | echo-affirmative
)" ;;
'--no-required'* | '--required'*) option_required="$(
get-flag-value required --missing="$option_required" -- "$item" | echo-affirmative
)" ;;
'--no-multi'* | '--multi'*)
option_multi="$(get-flag-value multi --missing="$option_multi" -- "$item" | echo-affirmative)"
;;
'--no-required'* | '--required'*)
option_required="$(get-flag-value required --missing="$option_required" -- "$item" | echo-affirmative)"
;;
'--')
items+=("$@")
shift $#
Expand Down
6 changes: 3 additions & 3 deletions commands/date-helper
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ function date_helper() (
case "$item" in
'--help' | '-h') help ;;
'--format='*) option_format="${item#*--format=}" ;;
'--no-utc'* | '--utc'*) option_utc="$(
get-flag-value utc --missing="$option_utc" -- "$item" | echo-affirmative
)" ;;
'--no-utc'* | '--utc'*)
option_utc="$(get-flag-value utc --missing="$option_utc" -- "$item" | echo-affirmative)"
;;
'--nextyear' | '--next-year') option_next_year='yes' ;;
'--gpg')
option_utc='no'
Expand Down
4 changes: 3 additions & 1 deletion commands/echo-lines
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ function echo_lines() (
'--help' | '-h') help ;;
'--columns='*) columns="${item#*--columns=}" ;;
'--indent='*) indent="${item#*--indent=}" ;;
'--no-quoted'* | '--quoted'*) quoted="$(get-flag-value quoted --missing="$quoted" -- "$item" | echo-affirmative)" ;;
'--no-quoted'* | '--quoted'*)
quoted="$(get-flag-value quoted --missing="$quoted" -- "$item" | echo-affirmative)"
;;
'--')
ARGS+=("$@")
shift $#
Expand Down
4 changes: 1 addition & 3 deletions commands/echo-quiet
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ function echo_quiet() (
case "$item" in
'--help' | '-h') help ;;
'--no-env'* | '--env'*)
option_env="$(
get-flag-value env --missing="$option_env" -- "$item" | echo-affirmative
)"
option_env="$(get-flag-value env --missing="$option_env" -- "$item" | echo-affirmative)"
;;
--)
# process
Expand Down
12 changes: 3 additions & 9 deletions commands/eval-helper
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,13 @@ function eval_helper() (
'--success='*) option_success="${item#*--success=}" ;;
'--failure='*) option_failure="${item#*--failure=}" ;;
'--no-confirm'* | '--confirm'*)
option_confirm="$(
get-flag-value confirm --missing="$option_confirm" -- "$item" | echo-affirmative
)"
option_confirm="$(get-flag-value confirm --missing="$option_confirm" -- "$item" | echo-affirmative)"
;;
'--no-shapeshifter'* | '--shapeshifter'*)
option_shapeshifter="$(
get-flag-value shapeshifter --missing="$option_shapeshifter" -- "$item" | echo-affirmative
)"
option_shapeshifter="$(get-flag-value shapeshifter --missing="$option_shapeshifter" -- "$item" | echo-affirmative)"
;;
'--no-wrap'* | '--wrap'*)
option_wrap="$(
get-flag-value wrap --missing="$option_wrap" -- "$item" | echo-affirmative
)"
option_wrap="$(get-flag-value wrap --missing="$option_wrap" -- "$item" | echo-affirmative)"
;;
'--')
cmd+=("$@")
Expand Down
4 changes: 2 additions & 2 deletions commands/fs-realpath
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ function fs_realpath() (
shift
case "$item" in
'--help' | '-h') help ;;
'--resolve'*)
'--no-resolve'* | '--resolve'*)
option_resolve="$(get-flag-value resolve --missing="$option_resolve" -- "$item" | echo-affirmative)"
;;
'--validate'*)
'--no-validate'* | '--validate'*)
option_validate="$(get-flag-value validate --missing="$option_validate" -- "$item" | echo-affirmative)"
;;
'--relative-to='*)
Expand Down
4 changes: 1 addition & 3 deletions commands/get-installer
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,7 @@ function get_installer() (
case "$item" in
'--help' | '-h') help ;;
'--no-invoke'* | '--invoke'*)
option_invoke="$(
get-flag-value invoke --missing="$option_invoke" -- "$item" | echo-affirmative
)"
option_invoke="$(get-flag-value invoke --missing="$option_invoke" -- "$item" | echo-affirmative)"
;;
'--first-success'*) option_first_success='yes' ;;
'--first-failure'*) option_first_failure='yes' ;;
Expand Down
6 changes: 3 additions & 3 deletions commands/is-affirmative
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function is_affirmative() (
shift
case "$item" in
'--help' | '-h') help ;;
'--no-ignore-empty'* | '--ignore-empty'*) ignore_empty="$(
get-flag-value ignore-empty --missing="$ignore_empty" -- "$item" | echo-affirmative
)" ;;
'--no-ignore-empty'* | '--ignore-empty'*)
ignore_empty="$(get-flag-value ignore-empty --missing="$ignore_empty" -- "$item" | echo-affirmative)"
;;
'--')
items+=("$@")
shift "$#"
Expand Down
35 changes: 17 additions & 18 deletions commands/mount-helper
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ function mount_helper() (

# coerce target
if test -n "$option_target"; then
option_target="$(fs-realpath -- "$option_target")"
option_target="$(fs-realpath --no-validate -- "$option_target")"
fi

# coerce source options by parsing source
Expand Down Expand Up @@ -883,7 +883,7 @@ function mount_helper() (

# coerce source
if test -n "$option_share"; then # option under [check]
option_share="$(fs-realpath -- "$option_share")"
option_share="$(fs-realpath --no-validate -- "$option_share")"
gocryptfs_source="$option_share"
if ! is-mac; then
mount_source="$option_share"
Expand Down Expand Up @@ -1793,19 +1793,18 @@ function mount_helper() (
'--unmount') option_actions+='[unmount]' ;;
'--check' | '--mounted') option_actions+='[check]' ;;

'--no-automount'* | '--automount'*) option_automount="$(
get-flag-value automount --missing="$option_automount" -- "$item" | echo-affirmative
)" ;;
'--no-cron'* | '--cron'*) option_cron="$(
get-flag-value cron --missing="$option_cron" -- "$item" | echo-affirmative
)" ;;
'--no-fstab'* | '--fstab'*) option_fstab="$(
get-flag-value fstab --missing="$option_fstab" -- "$item" | echo-affirmative
)" ;;

'--no-remount'* | '--remount'*) option_remount="$(
get-flag-value remount --missing="$option_remount" -- "$item" | echo-affirmative
)" ;;
'--no-automount'* | '--automount'*)
option_automount="$(get-flag-value automount --missing="$option_automount" -- "$item" | echo-affirmative)"
;;
'--no-cron'* | '--cron'*)
option_cron="$(get-flag-value cron --missing="$option_cron" -- "$item" | echo-affirmative)"
;;
'--no-fstab'* | '--fstab'*)
option_fstab="$(get-flag-value fstab --missing="$option_fstab" -- "$item" | echo-affirmative)"
;;
'--no-remount'* | '--remount'*)
option_remount="$(get-flag-value remount --missing="$option_remount" -- "$item" | echo-affirmative)"
;;

'--type='*) option_type="${item#*--type=}" ;;
'--samba' | '--smb' | '--smbfs' | '--cifs') option_type='samba' ;;
Expand All @@ -1815,9 +1814,9 @@ function mount_helper() (
'--user='*) option_user="${item#*--user=}" ;;
'--group='*) option_group="${item#*--group=}" ;;
'--owner='*) option_owner="${item#*--owner=}" ;;
'--no-own'* | '--own'*) option_own="$(
get-flag-value own --missing="$option_own" -- "$item" | echo-affirmative
)" ;;
'--no-own'* | '--own'*)
option_own="$(get-flag-value own --missing="$option_own" -- "$item" | echo-affirmative)"
;;

'--username='*) option_username="${item#*--username=}" ;;
'--password='*) option_password="${item#*--password=}" ;;
Expand Down
4 changes: 1 addition & 3 deletions commands/secret
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ function secret() (
case "$item" in
'--help' | '-h') help ;;
'--no-conceal'* | '--conceal'*)
option_conceal="$(
get-flag-value conceal --missing="$option_conceal" -- "$item" | echo-affirmative
)"
option_conceal="$(get-flag-value conceal --missing="$option_conceal" -- "$item" | echo-affirmative)"
;;
'--no-quiet'* | '--quiet'* | '--no-verbose'* | '--verbose'*) ;; # handled by echo-quiet
'signin') action='login' ;;
Expand Down
90 changes: 45 additions & 45 deletions commands/service-helper
Original file line number Diff line number Diff line change
Expand Up @@ -106,51 +106,51 @@ function fs_own() (
'--supported') supported='yes' ;;
'--ignore-missing' | '--ignore') ignore='yes' ;;
# service options
'--no-start'* | '--start'*) start="$(
get-flag-value start --missing="$start" -- "$item" | echo-affirmative
)" ;;
'--no-stop'* | '--stop'*) stop="$(
get-flag-value stop --missing="$stop" -- "$item" | echo-affirmative
)" ;;
'--no-restart'* | '--restart'*) restart="$(
get-flag-value restart --missing="$restart" -- "$item" | echo-affirmative
)" ;;
'--no-unmask'* | '--unmask'*) unmask="$(
get-flag-value unmask --missing="$unmask" -- "$item" | echo-affirmative
)" ;;
'--no-load'* | '--load'*) load="$(
get-flag-value load --missing="$load" -- "$item" | echo-affirmative
)" ;;
'--no-unload'* | '--unload'*) unload="$(
get-flag-value unload --missing="$unload" -- "$item" | echo-affirmative
)" ;;
'--no-enable'* | '--enable'*) enable="$(
get-flag-value enable --missing="$enable" -- "$item" | echo-affirmative
)" ;;
'--no-disable'* | '--disable'*) disable="$(
get-flag-value disable --missing="$disable" -- "$item" | echo-affirmative
)" ;;
'--no-reenable'* | '--reenable'*) reenable="$(
get-flag-value reenable --missing="$reenable" -- "$item" | echo-affirmative
)" ;;
'--no-status'* | '--status'*) status="$(
get-flag-value status --missing="$status" -- "$item" | echo-affirmative
)" ;;
'--no-logs'* | '--logs'*) logs="$(
get-flag-value logs --missing="$logs" -- "$item" | echo-affirmative
)" ;;
'--no-running'* | '--running'*) running="$(
get-flag-value running --missing="$running" -- "$item" | echo-affirmative
)" ;;
'--no-remove'* | '--remove'*) remove="$(
get-flag-value remove --missing="$remove" -- "$item" | echo-affirmative
)" ;;
'--no-exists'* | '--exists'*) exists="$(
get-flag-value exists --missing="$exists" -- "$item" | echo-affirmative
)" ;;
'--no-edit'* | '--edit'*) edit="$(
get-flag-value edit --missing="$edit" -- "$item" | echo-affirmative
)" ;;
'--no-start'* | '--start'*)
start="$(get-flag-value start --missing="$start" -- "$item" | echo-affirmative)"
;;
'--no-stop'* | '--stop'*)
stop="$(get-flag-value stop --missing="$stop" -- "$item" | echo-affirmative)"
;;
'--no-restart'* | '--restart'*)
restart="$(get-flag-value restart --missing="$restart" -- "$item" | echo-affirmative)"
;;
'--no-unmask'* | '--unmask'*)
unmask="$(get-flag-value unmask --missing="$unmask" -- "$item" | echo-affirmative)"
;;
'--no-load'* | '--load'*)
load="$(get-flag-value load --missing="$load" -- "$item" | echo-affirmative)"
;;
'--no-unload'* | '--unload'*)
unload="$(get-flag-value unload --missing="$unload" -- "$item" | echo-affirmative)"
;;
'--no-enable'* | '--enable'*)
enable="$(get-flag-value enable --missing="$enable" -- "$item" | echo-affirmative)"
;;
'--no-disable'* | '--disable'*)
disable="$(get-flag-value disable --missing="$disable" -- "$item" | echo-affirmative)"
;;
'--no-reenable'* | '--reenable'*)
reenable="$(get-flag-value reenable --missing="$reenable" -- "$item" | echo-affirmative)"
;;
'--no-status'* | '--status'*)
status="$(get-flag-value status --missing="$status" -- "$item" | echo-affirmative)"
;;
'--no-logs'* | '--logs'*)
logs="$(get-flag-value logs --missing="$logs" -- "$item" | echo-affirmative)"
;;
'--no-running'* | '--running'*)
running="$(get-flag-value running --missing="$running" -- "$item" | echo-affirmative)"
;;
'--no-remove'* | '--remove'*)
remove="$(get-flag-value remove --missing="$remove" -- "$item" | echo-affirmative)"
;;
'--no-exists'* | '--exists'*)
exists="$(get-flag-value exists --missing="$exists" -- "$item" | echo-affirmative)"
;;
'--no-edit'* | '--edit'*)
edit="$(get-flag-value edit --missing="$edit" -- "$item" | echo-affirmative)"
;;
'--')
services+=("$@")
shift $#
Expand Down
18 changes: 9 additions & 9 deletions commands/setup-mac-appstore
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ function setup_mac_appstore() (
shift
case "$item" in
'--help' | '-h') help ;;
'--no-install'* | '--install'*) install="$(
get-flag-value install --missing="$install" -- "$item" | echo-affirmative
)" ;;
'--no-upgrade'* | '--upgrade'*) upgrade="$(
get-flag-value upgrade --missing="$upgrade" -- "$item" | echo-affirmative
)" ;;
'--no-configure'* | '--configure'*) configure="$(
get-flag-value configure --missing="$configure" -- "$item" | echo-affirmative
)" ;;
'--no-install'* | '--install'*)
install="$(get-flag-value install --missing="$install" -- "$item" | echo-affirmative)"
;;
'--no-upgrade'* | '--upgrade'*)
upgrade="$(get-flag-value upgrade --missing="$upgrade" -- "$item" | echo-affirmative)"
;;
'--no-configure'* | '--configure'*)
configure="$(get-flag-value configure --missing="$configure" -- "$item" | echo-affirmative)"
;;
'--')
packages+=("$@")
shift $#
Expand Down
20 changes: 5 additions & 15 deletions commands/setup-util
Original file line number Diff line number Diff line change
Expand Up @@ -245,29 +245,19 @@ function setup_util() (
'--name='*) name="${item#--name=}" ;;
'--no-quiet'* | '--quiet'* | '--no-verbose'* | '--verbose'*) ;; # handled by echo-quiet
'--no-confirm'* | '--confirm'*)
confirm="$(
get-flag-value confirm --missing="$confirm" -- "$item" | echo-affirmative
)"
confirm="$(get-flag-value confirm --missing="$confirm" -- "$item" | echo-affirmative)"
;;
'--no-optional'* | '--optional'*)
optional="$(
get-flag-value optional --missing="$optional" -- "$item" | echo-affirmative
)"
optional="$(get-flag-value optional --missing="$optional" -- "$item" | echo-affirmative)"
;;
'--no-fallback'* | '--fallback'*)
fallback="$(
get-flag-value fallback --missing="$fallback" -- "$item" | echo-affirmative
)"
fallback="$(get-flag-value fallback --missing="$fallback" -- "$item" | echo-affirmative)"
;;
'--no-force'* | '--force'*)
force="$(
get-flag-value force --missing="$force" -- "$item" | echo-affirmative
)"
force="$(get-flag-value force --missing="$force" -- "$item" | echo-affirmative)"
;;
'--no-upgrade'* | '--upgrade'*)
upgrade="$(
get-flag-value upgrade --missing="$upgrade" -- "$item" | echo-affirmative
)"
upgrade="$(get-flag-value upgrade --missing="$upgrade" -- "$item" | echo-affirmative)"
;;
'--')
if test -z "$installer"; then
Expand Down

0 comments on commit a4814c2

Please sign in to comment.