From 0b97fa7114540b777e70cdec9be88ae8046b0fb6 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Sat, 19 Apr 2025 01:17:58 -0400 Subject: [PATCH] Evaluate completion arguments when called This makes the destinations update dynamically when they are added/removed. Unquote the echo statement so that it is correctly paresd by the -a options. --- share/completions/tmutil.fish | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/completions/tmutil.fish b/share/completions/tmutil.fish index 5d45a3777..368b15075 100644 --- a/share/completions/tmutil.fish +++ b/share/completions/tmutil.fish @@ -24,7 +24,7 @@ function __destination_ids if string match -q -r '^ID' -- $line # Got the destination ID set -f ID "$(string match -r -g '^ID\s+:\s+(.*)$' $line | string trim)" - echo "$ID\t'$name $kind'" + echo $ID\t$name $kind continue end end @@ -96,7 +96,7 @@ complete -c tmutil -f -n __fish_use_subcommand -a localsnapshot -d 'Create new l complete -c tmutil -f -n __fish_use_subcommand -a machinedirectory -d 'Print the path to the current machine directory' complete -c tmutil -f -n __fish_use_subcommand -a removedestination -d 'Removes a backup destination' -complete -c tmutil -f -n '__fish_seen_subcommand_from removedestination' -a "$(__destination_ids)" +complete -c tmutil -f -n '__fish_seen_subcommand_from removedestination' -a '$(__destination_ids)' complete -c tmutil -f -n __fish_use_subcommand -a removeexclusion -d 'Remove an exclusion' complete -c tmutil -f -n '__fish_seen_subcommand_from removeexclusion' -s v -d 'Volume exclusion' @@ -115,7 +115,7 @@ complete -c tmutil -f -n __fish_use_subcommand -a startbackup -d 'Begin a backup complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s a -l auto -d 'Automatic mode' complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s b -l block -d 'Block until finished' complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s r -l rotation -d 'Automatic rotation' -complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s d -l destination -r -a "$(__destination_ids)" -d 'Backup destination' +complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s d -l destination -r -a '$(__destination_ids)' -d 'Backup destination' complete -c tmutil -f -n __fish_use_subcommand -a stopbackup -d 'Cancel a backup currently in progress' @@ -128,7 +128,7 @@ complete -c tmutil -r -n __fish_use_subcommand -a verifychecksums -d 'Verify sna complete -c tmutil -f -n __fish_use_subcommand -a version -d 'Print version' complete -c tmutil -f -n __fish_use_subcommand -a setquota -d 'Set the quota for the destination in gigabytes' -complete -c tmutil -f -n '__fish_seen_subcommand_from setquota' -r -a "$(__destination_ids)" +complete -c tmutil -f -n '__fish_seen_subcommand_from setquota' -r -a '$(__destination_ids)' complete -c tmutil -f -n '__fish_seen_subcommand_from destinationinfo isexcluded compare status' -s X -d 'Print as XML' complete -c tmutil -f -n '__fish_seen_subcommand_from latestbackup listbackups' -s m -d 'Destination volume to list backups from'