fork/fish-shell

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

ccoVeilleFix typos in completions scripts0df6fa791

master
17.5 KiB206 linesraw
1# fish completions for mdadm, as documented under Debian Stretch (mdadm v3.4)
2# Known lacks :
3# - be more contextual : suggest according to available files, devices, arrays…
4# - especially, suggest values for levels, metadata format… according to the already given parameters
5# - some descriptions are not very useful, even a bit Captain Obvious-like
6# - some options could see their meaning in different contexts explained with different completions with proper tests for context
7# - misc and manage modes could be tested for, and the corresponding options proposed only in the right context
8#
9# -n tests have been simplified when __fish_contains_opt …; or _fish_not_contain_opt …: the options in the first test were removed from the second one,
10#     as their absence has already been checked, because this absence caused evaluation of __fish_not_contain_opt
11
12function __fish_mdadm_metadata_options
13    echo -e "0\tUse original 0.90 format superblock"
14    echo -e "0.90\tUse original 0.90 format superblock"
15    echo -e "1\tUse last 1.x format superblock"
16    echo -e "default\tUse last 1.x format superblock"
17    echo -e "1.0\tUse 1.0 format superblock"
18    echo -e "1.1\tUse 1.1 format superblock"
19    echo -e "1.2\tUse 1.2 format superblock"
20    echo -e "ddf\tUse DDF (Disk Data Format) format"
21    echo -e "imsm\tUse Intel(R) Matrix Storage Manager format"
22end
23
24function __fish_mdadm_level_options
25    echo -e "linear\tJBOD"
26    echo -e "raid0\tStripped volume (RAID 0)"
27    echo -e "0\tStripped volume (RAID 0)"
28    echo -e "stripe\tStripped volume (RAID 0)"
29    echo -e "raid1\tMirrored volume (RAID 1)"
30    echo -e "1\tMirrored volume (RAID 1)"
31    echo -e "mirror\tMirrored volume (RAID 1)"
32    echo -e "raid4\tStripped volume with parity disk (RAID 4)"
33    echo -e "4\tStripped volume with parity disk (RAID 4)"
34    echo -e "raid5\tStripped volume with distributed parity (RAID 5)"
35    echo -e "5\tStripped volume with distributed parity (RAID 5)"
36    echo -e "raid6\tStripped volume with double distributed parity (RAID 5)"
37    echo -e "6\tStripped volume with double distributed parity (RAID 5)"
38    echo -e "raid10\tMirrored stripped volume (RAID 10)"
39    echo -e "10\tMirrored stripped volume (RAID 10)"
40    echo -e "multipath\tMultiple access device, AKA multipath (deprecated)"
41    echo -e "mp\tMultiple access device, AKA multipath (deprecated)"
42    echo -e "faulty\tPseudo RAID layer for single device (akin faulty RAID 1)"
43    echo -e "container\tContainer" # To be clarified
44end
45
46function __fish_mdadm_layout_options # To be clarified
47    echo -e left-asymmetric
48    echo -e left-symmetric
49    echo -e right-asymmetric
50    echo -e right-symmetric
51    echo -e "la\tAlias of left-asymmetric"
52    echo -e "ra\tAlias of right-asymmetric"
53    echo -e "ls\tAlias of left-symmetric"
54    echo -e "rs\tAlias of right-symmetric"
55    echo -e parity-first
56    echo -e parity-last
57    echo -e ddf-zero-restart
58    echo -e ddf-N-restart
59    echo -e ddf-N-continue
60    echo -e left-symmetric-6
61    echo -e right-symmetric-6
62    echo -e left-asymmetric-6
63    echo -e right-asymmetric-6
64    echo -e parity-first-6
65    echo -e write-transient
66    echo -e "wt\tAlias of write-transient"
67    echo -e read-transient
68    echo -e "rt\tAlias of read-transient"
69    echo -e write-persistent
70    echo -e "wp\tAlias of write-persistent"
71    echo -e read-persistent
72    echo -e "rp\tAlias of read-persistent"
73    echo -e write-all
74    echo -e read-fixable
75    echo -e "rf\tAlias of read-fixable"
76    echo -e clear
77    echo -e flush
78    echo -e none
79    echo -e n
80    echo -e o
81    echo -e f
82    echo -e normalise
83    echo -e preserve
84end
85
86function __fish_mdadm_level_options
87    echo -e "yes\tUse standard format (default)"
88    echo -e "md\tUse a non-partitionable array"
89    echo -e "mdp\tUse a partitionable array"
90    echo -e "part\tUse a partitionable array"
91    echo -e "p\tUse a partitionable array"
92end
93
94function __fish_mdadm_update_options
95    echo -e "sparc2.2\tRemove superblock misalignment from SPARC kernel 2.2"
96    echo -e "summaries\tCorrect superblock summaries"
97    echo -e "uuid\tUpdate array UUID"
98    echo -e "name\tUpdate array name"
99    echo -e "nodes\tUpdate array nodes"
100    echo -e "homehost\tUpdate array homehost"
101    echo -e "home-cluster\tUpdate array cluster name"
102    echo -e "resync\tMark the array as dirty, thus forcing resync"
103    echo -e "byteorder\tReverse superblock endianness"
104    echo -e "devicesize\tRefresh device size"
105    echo -e "no-bitmap\tAssume bitmap absence"
106    echo -e "bbl\tReserve space for bad block list"
107    echo -e "no-bbl\tFree reserved space for bad block list"
108    echo -e "metadata\tConvert 0.90 metadata to 1.0"
109    echo -e "super-minor\tReset preferred minor to current one"
110end
111
112function __fish_mdadm_action_options
113    echo -e "idle\tAbort currently running actions"
114    echo -e "frozen\tAbort currently running actions, prevent their restart"
115    echo -e "check\tScrub the array (i.e. check consistency)"
116    echo -e "repair\tCheck, then resync"
117end
118
119# In the next 7 lines, the tested option is maintained into the search list to prevent suggesting it if it has already been used, as they cannot be used twice
120complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s A -l assemble -d "Assemble a pre-existing array"
121complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s B -l build -d "Build a legacy array without superblocks"
122complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s C -l create -d "Create a new array"
123complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s F -l follow -l monitor -d "Select monitor mode"
124complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s G -l grow -d "Change the size or shape of an active array"
125complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s I -l incremental -d "Manage devices in array, and possibly start it"
126complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l auto-detect -d "Start all auto-detected arrays"
127complete -c mdadm -s h -l help -d "Display help"
128complete -c mdadm -l help-options -d "Display more detailed help"
129complete -c mdadm -s V -l version -d "Print version information"
130complete -c mdadm -s v -l verbose -d "Be more verbose"
131complete -c mdadm -s q -l quiet -d "Be quiet"
132complete -c mdadm -s f -l force -d "Force operation"
133complete -c mdadm -s c -l config -r -d "Specify config file or directory"
134complete -c mdadm -s s -l scan -d "Scan for missing information"
135complete -c mdadm -s e -l metadata -a __fish_mdadm_metadata_options -x -d "Set metadata style to use"
136complete -c mdadm -l homehost -x -d "Provide home host identity"
137complete -c mdadm -l prefer -x -d "Give name format preference"
138complete -c mdadm -l home-cluster -x -d "Give cluster name"
139complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow; or __fish_not_contain_opt -s A assemble -s F follow monitor -s I incremental auto-detect' -s n -l raid-devices -x -d "Specify the number of active devices"
140complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -s x -l spare-devices -x -d "Specify the number of spare devices"
141complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -s z -l size -x -d "Specify the space to use from each drive"
142complete -c mdadm -n '__fish_contains_opt -s G grow' -s Z -l array-size -x -d "Specify the size made available on the array"
143complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -s c -l chunk -x -d "Specify the chunk size"
144complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -l rounding -x -d "Specify rounding factor"
145complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -s l -l level -a __fish_mdadm_level_options -x -d "Specify RAID level"
146complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -s p -l layout -l parity -a __fish_mdadm_layout_options -x -d "Specify data layout"
147complete -c mdadm -n '__fish_contains_opt -s A assemble -s B build -s C create -s G grow' -s b -l bitmap -r -d "Specify file for write-intent bitmap"
148complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -l bitmap-chunk -x -d "Specify chunksize of bitmap"
149complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow -s a add' -s W -l write-mostly -d "Prefer reading from other devices than these"
150complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l readwrite -d "Enable writes on array or device"
151complete -c mdadm -n '__fish_contains_opt -s B build -s C create; or __fish_not_contain_opt -s A assemble -s F follow monitor -s G grow -s I incremental' -s o -l readonly -d "Disable writes on array"
152complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -l write-behind -x -d "Enable write-behind mode"
153complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -l assume-clean -d "Assume the array is clean"
154complete -c mdadm -n '__fish_contains_opt -s A assemble -s G grow' -l backup-file -r -d "Use this file as a backup"
155complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -l data-offset -x -d "Specify start of array data"
156complete -c mdadm -n '__fish_contains_opt -s G grow' -l continue -d "Resume frozen --grow command"
157complete -c mdadm -n '__fish_contains_opt -s A assemble -s B build -s C create' -s N -l name -x -d "Set array name"
158complete -c mdadm -n '__fish_contains_opt -s A assemble -s B build -s C create -s I incremental; or __fish_not_contain_opt -s F follow monitor -s G grow' -s R -l run -d "Run array despite warnings"
159complete -c mdadm -n '__fish_contains_opt -s A assemble -s B build -s C create' -s a -l auto -l level -a __fish_mdadm_level_options -x -d "Give instruction for device file" # May be improved with device numbers management
160complete -c mdadm -n '__fish_contains_opt -s A assemble -s G grow' -s a -l add -d "Add devices to array"
161complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -l nodes -d "Specify max nodes in the cluster"
162complete -c mdadm -n '__fish_contains_opt -s B build -s C create -s G grow' -l write-journal -d "Specify journal device for RAID-4/5/6 array"
163complete -c mdadm -n '__fish_contains_opt -s A assemble' -s u -l uuid -x -d "UUID of array to assemble"
164complete -c mdadm -n '__fish_contains_opt -s A assemble' -s m -l super-minor -x -d "Minor number of array device"
165complete -c mdadm -n '__fish_contains_opt -s A assemble; and __fish_contains_opt -s s scan' -l no-degraded -d "Refuse to start without all drives"
166complete -c mdadm -n '__fish_contains_opt -s A assemble' -l invalid-backup -d "Do not ask for backup file, unavailable"
167complete -c mdadm -n '__fish_contains_opt -s A assemble' -s U -l update -a __fish_mdadm_update_options -x -d "Update superblock properties"
168complete -c mdadm -n '__fish_contains_opt -s A assemble' -l freeze-reshape -d "Freeze --grow command"
169complete -c mdadm -n '__fish_contains_opt -s F follow monitor; or __fish_not_contain_opt -s A assemble -s B build -s C create -s G grow -s I incremental auto-detect' -s t -l test -d "Test mode" # To be clarified
170complete -c mdadm -n '__fish_contains_opt -s G grow; or __fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s I incremental auto-detect' -s a -l add -d "Hot-add listed devices"
171complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l re-add -d "Re-add a previously removed device"
172complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l add-spare -d "Hot-add listed devices as spare"
173complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s r -l remove -d "Remove listed inactive devices"
174complete -c mdadm -n '__fish_contains_opt -s I incremental; or __fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow auto-detect' -s f -l fail -l set-faulty -d "Mark listed devices as faulty"
175complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l replace -d "Mark listed devices as requiring replacement"
176complete -c mdadm -n '__fish_contains_opt replace' -l with -d "Give devices as replacement"
177complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l cluster-confirm -d "Confirm existence of device"
178complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s Q -l query -d "Examine device for md use"
179complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s D -l detail -d "Print details on array"
180complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l detail-platform -d "Print details on platform capabilities"
181complete -c mdadm -n '__fish_contains_opt -s I incremental; or __fish_contains_opt -s D detail; or __fish_contains_opt detail-platform; or __fish_contains_opt -s E examine' -s Y -l export -d "Format data output as key=value pairs"
182complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s E -l examine -d "Print content of device metadata"
183complete -c mdadm -n '__fish_contains_opt -s E examine; or __fish_contains_opt -s A assemble' -l sparc2.2 -d "Fix examination for buggy SPARC 2.2 kernel RAID"
184complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s X -l examine-bitmap -d "Print report about bitmap"
185complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l examine-badblocks -d "List recorded bad blocks"
186complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l dump -r -d "Dump metadata to directory"
187complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l restore -r -d "Restore metadata from directory"
188complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s S -l stop -d "Deactivate array"
189complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l zero-superblock -d "Erase possible superblock"
190complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l kill-subarray -r -d "Delete subarray"
191complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l update-subarray -r -d "Update subarray" # To be clarified
192complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -s W -l wait -d "Wait for pending operations"
193complete -c mdadm -l wait-clean -d "Mark array as clean ASAP"
194complete -c mdadm -n '__fish_not_contain_opt -s A assemble -s B build -s C create -s F follow monitor -s G grow -s I incremental auto-detect' -l action -a __fish_mdadm_action_options -x -d "Set sync action for md devices"
195complete -c mdadm -n '__fish_contains_opt -s I incremental' -s r -l rebuild-map -d "Rebuild /run/mdadm/map"
196complete -c mdadm -n '__fish_contains_opt -s I incremental; and __fish_contains_opt -s f fail set-faulty' -l path -r -d "Automatically add eventually appearing device to array"
197complete -c mdadm -n '__fish_contains_opt -s F follow monitor' -s m -l mail -x -d "Mail address to send alerts to"
198complete -c mdadm -n '__fish_contains_opt -s F follow monitor' -s p -l program -l alert -x -d "Program to run in case of an event"
199complete -c mdadm -n '__fish_contains_opt -s F follow monitor' -s y -l syslog -d "Record events in syslog"
200complete -c mdadm -n '__fish_contains_opt -s F follow monitor' -s d -l delay -x -d "Polling interval"
201complete -c mdadm -n '__fish_contains_opt -s F follow monitor' -s r -l increment -x -d "Generate RebuildNN events each given percentage"
202complete -c mdadm -n '__fish_contains_opt -s F follow monitor' -s f -l daemonise -d "Run monitor mode as a daemon"
203complete -c mdadm -n '__fish_contains_opt -s F follow monitor; and __fish_contains_opt -s 1 oneshot' -s i -l pid-file -r -d "Write PID file when running as a daemon"
204complete -c mdadm -n '__fish_contains_opt -s F follow monitor' -s 1 -l oneshot -d "Check arrays only once"
205complete -c mdadm -n '__fish_contains_opt -s F follow monitor' -l no-sharing -d "Do not move spares between arrays"
206complete -c mdadm -n '__fish_contains_opt -s D detail; or __fish_contains_opt -s E examine' -s b -l brief -d "Be more concise"