fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes Altmanningercompletions/tmutil: namespace8b1f72c54

master
8.2 KiB135 linesraw
1# completion for tmutil (macOS)
2
3function __fish_tmutil_destination_ids
4    for line in $(tmutil destinationinfo)
5        if string match -q '*===*' -- $line
6            # New section so clear out variables
7            set -f name ''
8            set -f kind ''
9            continue
10        end
11
12        if string match -q -r '^Name' -- $line
13            # Got the destination name
14            set -f name "$(string match -r -g '^Name\s+:\s+(.*)$' $line | string trim)"
15            continue
16        end
17
18        if string match -q -r '^Kind' -- $line
19            # Got the destination name
20            set -f kind "$(string match -r -g '^Kind\s+:\s+(\w+)' $line | string trim)"
21            continue
22        end
23
24        if string match -q -r '^ID' -- $line
25            # Got the destination ID
26            set -f ID "$(string match -r -g '^ID\s+:\s+(.*)$' $line | string trim)"
27            echo $ID\t$name $kind
28            continue
29        end
30    end
31end
32
33complete -c tmutil -n __fish_use_subcommand -a status -d 'Display Time Machine status'
34complete -c tmutil -f -n '__fish_seen_subcommand_from status'
35
36complete -c tmutil -f -n __fish_use_subcommand -a addexclusion -d 'Add an exclusion not to back up a file'
37complete -c tmutil -r -n '__fish_seen_subcommand_from addexclusion' -s v -d 'Volume exclusion'
38complete -c tmutil -r -n '__fish_seen_subcommand_from addexclusion' -s p -d 'Path exclusion'
39
40complete -c tmutil -r -n __fish_use_subcommand -a associatedisk -d 'Bind a snapshot volume directory to the specified local disk'
41
42complete -c tmutil -r -n __fish_use_subcommand -a calculatedrift -d 'Determine the amount of change between snapshots'
43
44complete -c tmutil -r -n __fish_use_subcommand -a compare -d 'Perform a backup diff'
45complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s a -d 'Compare all supported metadata'
46complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s n -d 'No metadata comparison'
47complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s @ -d 'Compare extended attributes'
48complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s c -d 'Compare creation times'
49complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s d -d 'Compare file data forks'
50complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s e -d 'Compare ACLs'
51complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s f -d 'Compare file flags'
52complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s g -d 'Compare GIDs'
53complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s m -d 'Compare file modes'
54complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s s -d 'Compare sizes'
55complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s t -d 'Compare modification times'
56complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s u -d 'Compare UIDs'
57complete -c tmutil -r -n '__fish_seen_subcommand_from compare' -s D -d 'Limit traversal depth to depth levels from the beginning of iteration'
58complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s E -d 'Dont take exclusions into account'
59complete -c tmutil -r -n '__fish_seen_subcommand_from compare' -s I -d 'Ignore path'
60complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s U -d 'Ignore logical volume identity'
61
62complete -c tmutil -r -n __fish_use_subcommand -a delete -d 'Delete one or more snapshots'
63complete -c tmutil -r -n '__fish_seen_subcommand_from delete' -s d -d 'Backup mount point'
64complete -c tmutil -r -f -n '__fish_seen_subcommand_from delete' -s t -d Timestamp
65complete -c tmutil -r -n '__fish_seen_subcommand_from delete' -s p -d Path
66
67complete -c tmutil -r -n __fish_use_subcommand -a deletelocalsnapshots -d 'Delete all local Time Machine snapshots for the specified date (formatted YYYY-MM-DD-HHMMSS)'
68
69complete -c tmutil -r -n __fish_use_subcommand -a deleteinprogress -d 'Delete all in-progress backups for a machine directory'
70
71complete -c tmutil -f -n __fish_use_subcommand -a destinationinfo -d 'Print information about destinations'
72
73complete -c tmutil -f -n __fish_use_subcommand -a disable -d 'Turn off automatic backups'
74
75complete -c tmutil -f -n __fish_use_subcommand -a disablelocal -d 'Turn off local Time Machine snapshots'
76
77complete -c tmutil -f -n __fish_use_subcommand -a enable -d 'Turn on automatic backups'
78
79complete -c tmutil -f -n __fish_use_subcommand -a enablelocal -d 'Turn on local Time Machine snapshots'
80
81complete -c tmutil -r -n __fish_use_subcommand -a inheritbackup -d 'Claim a machine directory or sparsebundle for use by the current machine'
82
83complete -c tmutil -r -n __fish_use_subcommand -a isexcluded -d 'Determine if a file, directory, or volume are excluded from backups'
84
85complete -c tmutil -f -n __fish_use_subcommand -a latestbackup -d 'Print the path to the latest snapshot'
86
87complete -c tmutil -f -n __fish_use_subcommand -a listlocalsnapshotdates -d 'List the creation dates of all local Time Machine snapshots'
88
89complete -c tmutil -r -n __fish_use_subcommand -a listlocalsnapshots -d 'List local Time Machine snapshots of the specified volume'
90
91complete -c tmutil -f -n __fish_use_subcommand -a listbackups -d 'Print paths for all snapshots'
92
93complete -c tmutil -f -n __fish_use_subcommand -a localsnapshot -d 'Create new local Time Machine snapshot of APFS volume in TM backup'
94
95complete -c tmutil -f -n __fish_use_subcommand -a machinedirectory -d 'Print the path to the current machine directory'
96
97complete -c tmutil -f -n __fish_use_subcommand -a removedestination -d 'Removes a backup destination'
98complete -c tmutil -f -n '__fish_seen_subcommand_from removedestination' -a '$(__fish_tmutil_destination_ids)'
99
100complete -c tmutil -f -n __fish_use_subcommand -a removeexclusion -d 'Remove an exclusion'
101complete -c tmutil -f -n '__fish_seen_subcommand_from removeexclusion' -s v -d 'Volume exclusion'
102complete -c tmutil -f -n '__fish_seen_subcommand_from removeexclusion' -s p -d 'Path exclusion'
103
104complete -c tmutil -f -n __fish_use_subcommand -a restore -d 'Restore an item'
105complete -c tmutil -r -n '__fish_seen_subcommand_from restore' -s v
106
107complete -c tmutil -r -n __fish_use_subcommand -a setdestination -d 'Set a backup destination'
108complete -c tmutil -f -n '__fish_seen_subcommand_from setdestination' -s a -d 'Add to the list of destinations'
109complete -c tmutil -f -n '__fish_seen_subcommand_from setdestination' -s p -d 'Enter the password at a non-echoing interactive prompt'
110
111complete -c tmutil -f -n __fish_use_subcommand -a snapshot -f -d 'Create new local Time Machine snapshot'
112
113complete -c tmutil -f -n __fish_use_subcommand -a startbackup -d 'Begin a backup if one is not already running'
114complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s a -l auto -d 'Automatic mode'
115complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s b -l block -d 'Block until finished'
116complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s r -l rotation -d 'Automatic rotation'
117complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s d -l destination -r -a '$(__fish_tmutil_destination_ids)' -d 'Backup destination'
118
119complete -c tmutil -f -n __fish_use_subcommand -a stopbackup -d 'Cancel a backup currently in progress'
120
121complete -c tmutil -r -n __fish_use_subcommand -a thinlocalsnapshots -d 'Thin local Time Machine snapshots for the specified volume'
122
123complete -c tmutil -r -n __fish_use_subcommand -a uniquesize -d 'Analyze the specified path and determine its unique size'
124
125complete -c tmutil -r -n __fish_use_subcommand -a verifychecksums -d 'Verify snapshot'
126
127complete -c tmutil -f -n __fish_use_subcommand -a version -d 'Print version'
128
129complete -c tmutil -f -n __fish_use_subcommand -a setquota -d 'Set the quota for the destination in gigabytes'
130complete -c tmutil -f -n '__fish_seen_subcommand_from setquota' -r -a '$(__fish_tmutil_destination_ids)'
131
132complete -c tmutil -f -n '__fish_seen_subcommand_from destinationinfo isexcluded compare status' -s X -d 'Print as XML'
133complete -c tmutil -f -n '__fish_seen_subcommand_from latestbackup listbackups' -s m -d 'Destination volume to list backups from'
134complete -c tmutil -f -n '__fish_seen_subcommand_from latestbackup listbackups' -s t -d 'Attempt to mount the backups and list their mounted paths'
135complete -c tmutil -f -n '__fish_seen_subcommand_from latestbackup listbackups' -s d -d 'Backup mount point'