fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
95b93c6bf
master
1# Completions for btrfs-progs 2 3# Todo: 4# - (Done) Detailed options per command 5# - Simplified duplicate options completion with `for` 6# - Simplified descriptions 7 8# Filter the completions per primary command 9function __btrfs_commands 10if not set -q argv[ 1 ] 11return 1 12end 13set -l cmd( commandline -cp) 14if string match -qr --"btrfs\s+ $argv [ 1 ] \s+\S*" $cmd 15return 0 16end 17return 1 18end 19 20# Filter the completions per command group 21function __btrfs_command_groups 22if not set -q argv[ 1 ] 23return 1 24end 25set -l cmd( commandline -cp) 26if set -q argv[ 2 ] 27if string match -qr --"btrfs\s+ $argv [ 1 ] \s+ $argv [ 2 ] \s+\S*" $cmd 28return 0 29end 30return 1 31end 32if string match -qr --"btrfs\s+ $argv [ 1 ] \s+\S*\$" $cmd 33return 0 34end 35return 1 36end 37 38set -l check'__btrfs_commands check' 39set -l restore'__btrfs_commands restore' 40set -l send'__btrfs_commands send' 41set -l receive'__btrfs_commands receive' 42set -l help'__btrfs_commands help' 43 44set -l subvolume'__btrfs_command_groups subvolume' 45set -l filesystem'__btrfs_command_groups filesystem' 46set -l balance'__btrfs_command_groups balance' 47set -l device'__btrfs_command_groups device' 48set -l scrub'__btrfs_command_groups scrub' 49set -l rescue'__btrfs_command_groups rescue' 50set -l inspect_internal'__btrfs_command_groups inspect-internal' 51set -l property'__btrfs_command_groups property' 52set -l quota'__btrfs_command_groups quota' 53set -l qgroup'__btrfs_command_groups qgroup' 54set -l replace'__btrfs_command_groups replace' 55 56# Global command 57complete -f -c btrfs -l help -d'Display help information' 58 59# Primary command 60complete -f -c btrfs -n __fish_is_first_arg -a check -d'Check structural integrity of a filesystem (unmounted).' 61complete -f -c btrfs -n __fish_is_first_arg -a restore -d'Try to restore files from a damaged filesystem (unmounted)' 62complete -f -c btrfs -n __fish_is_first_arg -a send -d'Send the subvolume(s) to stdout.' 63complete -f -c btrfs -n __fish_is_first_arg -a receive -d'Receive subvolumes from a stream' 64complete -f -c btrfs -n __fish_is_first_arg -a help -d'Display help information' 65complete -f -c btrfs -n __fish_is_first_arg -a version -d'Display btrfs-progs version' 66 67# Primary command groups 68complete -f -c btrfs -n __fish_is_first_arg -a subvolume -d'manage subvolumes: create, delete, list, etc' 69complete -f -c btrfs -n __fish_is_first_arg -a filesystem -d'overall filesystem tasks and information' 70complete -f -c btrfs -n __fish_is_first_arg -a balance -d'balance data across devices, or change block groups using filters' 71complete -f -c btrfs -n __fish_is_first_arg -a device -d'manage and query devices in the filesystem' 72complete -f -c btrfs -n __fish_is_first_arg -a scrub -d'verify checksums of data and metadata' 73complete -f -c btrfs -n __fish_is_first_arg -a rescue -d'toolbox for specific rescue operations' 74complete -f -c btrfs -n __fish_is_first_arg -a inspect-internal -d'query various internal information' 75complete -f -c btrfs -n __fish_is_first_arg -a property -d'modify properties of filesystem objects' 76complete -f -c btrfs -n __fish_is_first_arg -a quota -d'manage filesystem quota settings' 77complete -f -c btrfs -n __fish_is_first_arg -a qgroup -d'manage quota groups' 78complete -f -c btrfs -n __fish_is_first_arg -a replace -d'replace a device in the filesystem' 79 80# btrfs check 81complete -f -c btrfs -n$check -s s -l super -d'Use this SUPERBLOCK copy' 82complete -f -c btrfs -n$check -s b -l backup -d'Use the first valid BACKUP root copy' 83complete -f -c btrfs -n$check -s r -l tree-root -d'Use the given bytenr for the TREE root' 84complete -f -c btrfs -n$check -l chunk-root -d'Use the given bytenr for the CHUNK-TREE root' 85complete -f -c btrfs -n$check -l readonly -d'Run in read-only mode' 86complete -f -c btrfs -n$check -l repair -d'Try to repair the filesystem' 87complete -f -c btrfs -n$check -l force -d'Skip mount checks, repair is not possible' 88complete -f -c btrfs -n$check -l mode -d'Allows choice of memory/IO trade-offs' -ra'{original,lowmem}' 89complete -f -c btrfs -n$check -l init-csum-tree -d'Create a new CRC tree (repair only)' 90complete -f -c btrfs -n$check -l init-extent-tree -d'Create a new extent tree (repair only)' 91complete -f -c btrfs -n$check -l clear-space-cache -d'clear space cache (repair only)' -ra'{v1,v2}' 92complete -f -c btrfs -n$check -l check-data-csum -d'Verify checksums of data blocks' 93complete -f -c btrfs -n$check -s Q -l qgroup-report -d'Print a report on qgroup consistency' 94complete -f -c btrfs -n$check -s E -l subvol-extents -d'Print subvolume extents and sharing state' 95complete -f -c btrfs -n$check -s p -l progress -d'Indicate progress' 96 97# btrfs restore 98complete -f -c btrfs -n$restore -s s -l snapshots -d'Get snapshots' 99complete -f -c btrfs -n$restore -s x -l xattr -d'Restore extended attributes' 100complete -f -c btrfs -n$restore -s m -l metadata -d'Restore owner, mode and times' 101complete -f -c btrfs -n$restore -s S -l symlink -d'Restore symbolic links' 102complete -f -c btrfs -n$restore -s v -l verbose -d Verbose 103complete -f -c btrfs -n$restore -s i -l ignore-errors -d'Ignore errors' 104complete -f -c btrfs -n$restore -s o -l overwrite -d Overwrite 105complete -f -c btrfs -n$restore -s t -r -d'Tree location' 106complete -f -c btrfs -n$restore -s f -r -d'Filesystem location' 107complete -f -c btrfs -n$restore -s u -l super -r -d'Super mirror' 108complete -f -c btrfs -n$restore -s r -l root -r -d'Root objectid' 109complete -f -c btrfs -n$restore -s d -d'Find dir' 110complete -f -c btrfs -n$restore -s l -l list-roots -d'List tree roots' 111complete -f -c btrfs -n$restore -s D -l dry-run -d'Only list files that would be recovered' 112complete -f -c btrfs -n$restore -l path-regex -r -d'Restore only filenames matching regex' 113complete -f -c btrfs -n$restore -s c -d'Ignore case (--path-regex only)' 114 115# btrfs send 116complete -f -c btrfs -n$send -s e -d'' 117complete -f -c btrfs -n$send -s p -r -d'Send an incremental stream from <parent> to <subvol>' 118complete -f -c btrfs -n$send -s c -r -d'Use this snapshot as a clone source for an incremental send' 119complete -f -c btrfs -n$send -s f -r -d'Output is normally written to stdout' 120complete -f -c btrfs -n$send -l no-data -d'send in NO_FILE_DATA mode' 121complete -f -c btrfs -n$send -s v -l verbose -d'Enable verbose output to stderr' 122complete -f -c btrfs -n$send -s q -l quiet -d'Suppress all messages, except errors' 123complete -f -c btrfs -n$send -l proto -a'0 1 2' -r -d'Use send protocol version' 124complete -f -c btrfs -n$send -l proto -l compressed-data -d'Send compressed data directly' 125 126# btrfs receive 127complete -f -c btrfs -n$receive -s v -d'Increase verbosity about performed actions' 128complete -f -c btrfs -n$receive -s q -l quiet -d'Suppress all messages, except errors' 129complete -f -c btrfs -n$receive -s f -r -d'Read the stream from FILE instead of stdin' 130complete -f -c btrfs -n$receive -s e -d'Terminate after receiving an <end cmd> marker in the stream' 131complete -f -c btrfs -n$receive -s C -l chroot -d'Confine the process to <mount> using chroot' 132complete -f -c btrfs -n$receive -s E -l max-errors -r -d'Terminate when NUMBER errors occur' 133complete -f -c btrfs -n$receive -s m -r -d'The root mount point of the destination filesystem' 134complete -f -c btrfs -n$receive -l force-decompress -r -d'Always decompress data' 135complete -f -c btrfs -n$receive -l dump -d'Dump stream metadata' 136 137# btrfs help 138complete -f -c btrfs -n$help -l full -d'Display detailed help on every command' 139complete -f -c btrfs -n$help -l box -d'Show list of built-in tools (busybox style)' 140 141# btrfs subvolume 142complete -f -c btrfs -n$subvolume -a create -d'Create a subvolume' 143complete -f -c btrfs -n$subvolume -a delete -d'Delete subvolume(s)' 144complete -f -c btrfs -n$subvolume -a list -d'List subvolumes and snapshots in the filesystem.' 145complete -f -c btrfs -n$subvolume -a snapshot -d'Create a snapshot of the subvolume' 146complete -f -c btrfs -n$subvolume -a get-default -d'Get the default subvolume of a filesystem' 147complete -f -c btrfs -n$subvolume -a set-default -d'Set the default subvolume of the filesystem mounted as default.' 148complete -f -c btrfs -n$subvolume -a find-new -d'List the recently modified files in a filesystem' 149complete -f -c btrfs -n$subvolume -a show -d'Show more information about the subvolume' 150complete -f -c btrfs -n$subvolume -a sync -d'Wait until given subvolume(s) are completely removed from the filesystem.' 151# btrfs subvolume create 152complete -f -c btrfs -n'__btrfs_command_groups subvolume create' -s i -d'Add subvolume to a qgroup (can be given multiple times)' 153complete -f -c btrfs -n'__btrfs_command_groups subvolume create' -s p -d'Create any missing parent directories' 154# btrfs subvolume delete 155complete -f -c btrfs -n'__btrfs_command_groups subvolume delete' -s c -l commit-after -d'Wait for transaction commit at the end of the operation' 156complete -f -c btrfs -n'__btrfs_command_groups subvolume delete' -s C -l commit-each -d'Wait for transaction commit after deleting each subvolume' 157complete -f -c btrfs -n'__btrfs_command_groups subvolume delete' -s R -l recursive -d'Delete subvolumes beneath each subvolume recursively' 158complete -f -c btrfs -n'__btrfs_command_groups subvolume delete' -s v -l verbose -d'Verbose output of operations' 159# btrfs subvolume list 160complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s o -d'Print only subvolumes below specified path' 161complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s a -d'Print all the subvolumes and absolute and relative path' 162complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s p -d'Print parent ID' 163complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s c -d'Print the ogeneration of the subvolume' 164complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s g -d'Print the generation of the subvolume' 165complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s u -d'Print the uuid of subvolumes (and snapshots)' 166complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s q -d'Print the parent uuid of the snapshots' 167complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s R -d'Print the uuid of the received snapshots' 168complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s s -d'List only snapshots' 169complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s r -d'List readonly subvolumes (including snapshots)' 170complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s d -d'List deleted subvolumes that are not yet cleaned' 171complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s t -d'Print the result as a table' 172complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s G -r -d'Filter the subvolumes by generation' 173complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -s C -r -d'Filter the subvolumes by ogeneration' 174complete -f -c btrfs -n'__btrfs_command_groups subvolume list' -l sort -d'List the subvolume in order' -a'{gen,ogen,rootid,path}' 175# btrfs subvolume snapshot 176complete -f -c btrfs -n'__btrfs_command_groups subvolume snapshot' -s r -d'Create a readonly snapshot' 177complete -f -c btrfs -n'__btrfs_command_groups subvolume snapshot' -s i -d'Add snapshot to a qgroup (can be given multiple times)' 178# btrfs subvolume show 179complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s r -l rootid -d'Show rootid of the subvolume' 180complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s u -l uuid -d'Show uuid of the subvolume' 181complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s b -l raw -d'Show raw numbers in bytes' 182complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s h -l human-readable -d'Show human friendly numbers, base 1024' 183complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s H -d'Show human friendly numbers, base 1000' 184complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 185complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 186complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s k -l kbytes -d'Show sizes in KiB, or kB with --si' 187complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s m -l mbytes -d'Show sizes in MiB, or MB with --si' 188complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s g -l gbytes -d'Show sizes in GiB, or GB with --si' 189complete -f -c btrfs -n'__btrfs_command_groups subvolume show' -s t -l tbytes -d'Show sizes in TiB, or TB with --si' 190# btrfs subvolume sync 191complete -f -c btrfs -n'__btrfs_command_groups subvolume sync' -s s -d'Sleep NUMBER seconds between checks' 192 193# btrfs filesystem 194complete -f -c btrfs -n$filesystem -a df -d'Show space usage information for a mount point' 195complete -f -c btrfs -n$filesystem -a du -d'Summarize disk usage of each file.' 196complete -f -c btrfs -n$filesystem -a show -d'Show the structure of a filesystem' 197complete -f -c btrfs -n$filesystem -a sync -d'Force a sync on a filesystem' 198complete -f -c btrfs -n$filesystem -a defragment -d'Defragment a file or a directory' 199complete -f -c btrfs -n$filesystem -a resize -d'Resize a filesystem' 200complete -f -c btrfs -n$filesystem -a label -d'Get or change the label of a filesystem' 201complete -f -c btrfs -n$filesystem -a usage -d'Show detailed information about internal filesystem usage.' 202complete -f -c btrfs -n$filesystem -a mkswapfile -d'Create a new swapfile' 203# btrfs filesystem df 204complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -s b -l raw -d'Show raw numbers in bytes' 205complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -s h -l human-readable -d'Show human friendly numbers, base 1024' 206complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -s H -d'Show human friendly numbers, base 1000' 207complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 208complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 209complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -s k -l kbytes -d'Show sizes in KiB, or kB with --si' 210complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -s m -l mbytes -d'Show sizes in MiB, or MB with --si' 211complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -s g -l gbytes -d'Show sizes in GiB, or GB with --si' 212complete -f -c btrfs -n'__btrfs_command_groups filesystem df' -s t -l tbytes -d'Show sizes in TiB, or TB with --si' 213# btrfs filesystem du 214complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -s s -l summarize -d'Display only a total for each argument' 215complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -l raw -d'Show raw numbers in bytes' 216complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -l human-readable -d'Show human friendly numbers, base 1024' 217complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 218complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 219complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -l kbytes -d'Show sizes in KiB, or kB with --si' 220complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -l mbytes -d'Show sizes in MiB, or MB with --si' 221complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -l gbytes -d'Show sizes in GiB, or GB with --si' 222complete -f -c btrfs -n'__btrfs_command_groups filesystem du' -l tbytes -d'Show sizes in TiB, or TB with --si' 223# btrfs filesystem show 224complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -s d -l all-devices -d'Show only disks under /dev containing btrfs filesystem' 225complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -s m -l mounted -d'Show only mounted btrfs' 226complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -l raw -d'Show raw numbers in bytes' 227complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -l human-readable -d'Show human friendly numbers, base 1024' 228complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 229complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 230complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -l kbytes -d'Show sizes in KiB, or kB with --si' 231complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -l mbytes -d'Show sizes in MiB, or MB with --si' 232complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -l gbytes -d'Show sizes in GiB, or GB with --si' 233complete -f -c btrfs -n'__btrfs_command_groups filesystem show' -l tbytes -d'Show sizes in TiB, or TB with --si' 234# btrfs filesystem defragment 235complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -s v -d'Be verbose' 236complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -s r -d'Defragment files recursively' 237complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -s c -d'Compress the file while defragmenting' -ra'{zlib,lzo,zstd}' 238complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -s f -d'Flush data to disk immediately after defragmenting' 239complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -s s -r -d'Defragment only from NUMBER byte onward' 240complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -s l -r -d'Defragment only up to LEN bytes' 241complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -s t -r -d'Target extent SIZE hint' 242complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -l step -r -d'Defragment in steps of SIZE' 243complete -f -c btrfs -n'__btrfs_command_groups filesystem defragment' -s L -l level -r -d'Specify compression levels' 244 245# btrfs filesystem usage 246complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -s b -l raw -d'Show raw numbers in bytes' 247complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -s h -l human-readable -d'Show human friendly numbers, base 1024' 248complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -s H -d'Show human friendly numbers, base 1000' 249complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 250complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 251complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -s k -l kbytes -d'Show sizes in KiB, or kB with --si' 252complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -s m -l mbytes -d'Show sizes in MiB, or MB with --si' 253complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -s g -l gbytes -d'Show sizes in GiB, or GB with --si' 254complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -s t -l tbytes -d'Show sizes in TiB, or TB with --si' 255complete -f -c btrfs -n'__btrfs_command_groups filesystem usage' -s T -d'Show data in tabular format' 256# btrfs filesystem mkswapfile 257complete -f -c btrfs -n'__btrfs_command_groups filesystem mkswapfile' -s s -l size -r -d'Swapfile size' 258complete -f -c btrfs -n'__btrfs_command_groups filesystem mkswapfile' -s U -l uuid -r -d'UUID for the swapfile' 259# btrfs filesystem resize 260complete -f -c btrfs -n'__btrfs_command_groups filesystem resize' -l enqueue -d'Wait for other exclusive operations' 261 262# btrfs balance 263complete -f -c btrfs -n$balance -a start -d'Balance chunks across the devices' 264complete -f -c btrfs -n$balance -a pause -d'Pause running balance' 265complete -f -c btrfs -n$balance -a cancel -d'Cancel running or paused balance' 266complete -f -c btrfs -n$balance -a resume -d'Resume interrupted balance' 267complete -f -c btrfs -n$balance -a status -d'Show status of running or paused balance' 268# btrfs balance start 269function __btrfs_balance_filters 270set -l profiles raid{ 0 , 1 {, c3, c4}, 10 , 5 , 6 } dup single 271set -l btrfs_balance_filters\ 272 profiles=$profiles \t"Balances only block groups with the given profiles" \ 273 convert=$profiles \t"Convert selected block groups to given profile" \ 274 usage= devid= vrange= limit= strips= soft 275set -l prefix( commandline -tc| string replace -r'^-d' --'' | string match -rg'^(.*?)?[^,]*$' --$token ) 276printf "%s\n" " $prefix " $btrfs_balance_filters 277end 278complete -f -c btrfs -n'__btrfs_command_groups balance start' -s d -ra'(__btrfs_balance_filters)' -d'Act on data chunks with FILTERS' 279complete -f -c btrfs -n'__btrfs_command_groups balance start' -s m -ra'(__btrfs_balance_filters)' -d'Act on metadata chunks with FILTERS' 280complete -f -c btrfs -n'__btrfs_command_groups balance start' -s s -ra'(__btrfs_balance_filters)' -d'Act on system chunks with FILTERS (only under -f)' 281complete -f -c btrfs -n'__btrfs_command_groups balance start' -s v -d'Be verbose' 282complete -f -c btrfs -n'__btrfs_command_groups balance start' -s f -d'Force a reduction of metadata integrity' 283complete -f -c btrfs -n'__btrfs_command_groups balance start' -l full-balance -d'Do not print warning and do not delay start' 284complete -f -c btrfs -n'__btrfs_command_groups balance start' -l background -l bg -d'Run the balance as a background process' 285complete -f -c btrfs -n'__btrfs_command_groups balance start' -l enqueue -d'Wait for other exclusive operations' 286# btrfs balance status 287complete -f -c btrfs -n'__btrfs_command_groups balance status' -s v -d'Be verbose' 288 289# btrfs device 290complete -f -c btrfs -n$device -a add -d'Add one or more devices to a mounted filesystem.' 291complete -f -c btrfs -n$device -a delete -d'Remove a device from a filesystem' 292complete -f -c btrfs -n$device -a remove -d'Remove a device from a filesystem' 293complete -f -c btrfs -n$device -a scan -d'Scan or forget (unregister) devices of btrfs filesystems' 294complete -f -c btrfs -n$device -a ready -d'Check and wait until a group of devices of a filesystem is ready for mount' 295complete -f -c btrfs -n$device -a stats -d'Show device IO error statistics' 296complete -f -c btrfs -n$device -a usage -d'Show detailed information about internal allocations in devices.' 297# btrfs device add 298complete -f -c btrfs -n'__btrfs_command_groups device add' -s K -l nodiscard -d'Do not perform TRIM on DEVICES' 299complete -f -c btrfs -n'__btrfs_command_groups device add' -s f -l force -d'Force overwrite existing filesystem on the disk' 300# btrfs device scan 301complete -f -c btrfs -n'__btrfs_command_groups device scan' -s d -l all-devices -d'Enumerate and register all devices' 302complete -f -c btrfs -n'__btrfs_command_groups device scan' -s u -l forget -d'Unregister a given device or all stale devices' 303# btrfs device stats 304complete -f -c btrfs -n'__btrfs_command_groups device stats' -s c -l check -d'Return non-zero if any stat counter is not zero' 305complete -f -c btrfs -n'__btrfs_command_groups device stats' -s z -l reset -d'Show current stats and reset values to zero' 306complete -f -c btrfs -n'__btrfs_command_groups device stats' -s T -d"Print stats in a tabular form" 307# btrfs device remove 308complete -f -c btrfs -n'__btrfs_command_groups device remove' -l enqueue -d'Wait for other exclusive operations' 309complete -f -c btrfs -n'__btrfs_command_groups device remove' -l force -d'Skip the safety timeout for removing multiple devices' 310# btrfs device usage 311complete -f -c btrfs -n'__btrfs_command_groups device usage' -s b -l raw -d'Show raw numbers in bytes' 312complete -f -c btrfs -n'__btrfs_command_groups device usage' -s h -l human-readable -d'Show human friendly numbers, base 1024' 313complete -f -c btrfs -n'__btrfs_command_groups device usage' -s H -d'Show human friendly numbers, base 1000' 314complete -f -c btrfs -n'__btrfs_command_groups device usage' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 315complete -f -c btrfs -n'__btrfs_command_groups device usage' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 316complete -f -c btrfs -n'__btrfs_command_groups device usage' -s k -l kbytes -d'Show sizes in KiB, or kB with --si' 317complete -f -c btrfs -n'__btrfs_command_groups device usage' -s m -l mbytes -d'Show sizes in MiB, or MB with --si' 318complete -f -c btrfs -n'__btrfs_command_groups device usage' -s g -l gbytes -d'Show sizes in GiB, or GB with --si' 319complete -f -c btrfs -n'__btrfs_command_groups device usage' -s t -l tbytes -d'Show sizes in TiB, or TB with --si' 320 321# btrfs scrub 322complete -f -c btrfs -n$scrub -a start -d'Start a new scrub. If a scrub is already running, the new one fails.' 323complete -f -c btrfs -n$scrub -a cancel -d'Cancel a running scrub' 324complete -f -c btrfs -n$scrub -a resume -d'Resume previously canceled or interrupted scrub' 325complete -f -c btrfs -n$scrub -a status -d'Show status of running or finished scrub' 326complete -f -c btrfs -n$scrub -a limit -d'Show or set scrub limits on devices of the given filesystem' 327# btrfs scrub limit 328complete -f -c btrfs -n'__btrfs_command_groups scrub limit' -s d -l devid -d'Select the device by DEVID to apply the limit' 329complete -f -c btrfs -n'__btrfs_command_groups scrub limit' -s l -l limit -d'Set the limit of the device' 330complete -f -c btrfs -n'__btrfs_command_groups scrub limit' -s a -l all -d'Apply the limit to all devices' 331# btrfs scrub start 332complete -f -c btrfs -n'__btrfs_command_groups scrub start' -s B -d'Do not background' 333complete -f -c btrfs -n'__btrfs_command_groups scrub start' -s d -d'Stats per device (-B only)' 334complete -f -c btrfs -n'__btrfs_command_groups scrub start' -s q -d'Be quiet' 335complete -f -c btrfs -n'__btrfs_command_groups scrub start' -s r -d'Read only mode' 336complete -f -c btrfs -n'__btrfs_command_groups scrub start' -s R -d'Raw print mode, print full data instead of summary' 337complete -f -c btrfs -n'__btrfs_command_groups scrub start' -l limit -d'Set the scrub throughput limit' 338complete -f -c btrfs -n'__btrfs_command_groups scrub start' -s c -d'Set ioprio class (see ionice(1) manpage)' 339complete -f -c btrfs -n'__btrfs_command_groups scrub start' -s n -d'Set ioprio classdata (see ionice(1) manpage)' 340complete -f -c btrfs -n'__btrfs_command_groups scrub start' -s f -d'Force starting new scrub' 341# btrfs scrub resume 342complete -f -c btrfs -n'__btrfs_command_groups scrub resume' -s B -d'Do not background' 343complete -f -c btrfs -n'__btrfs_command_groups scrub resume' -s d -d'Stats per device (-B only)' 344complete -f -c btrfs -n'__btrfs_command_groups scrub resume' -s q -d'Be quiet' 345complete -f -c btrfs -n'__btrfs_command_groups scrub resume' -s r -d'Read only mode' 346complete -f -c btrfs -n'__btrfs_command_groups scrub resume' -s R -d'Raw print mode, print full data instead of summary' 347complete -f -c btrfs -n'__btrfs_command_groups scrub resume' -s c -d'Set ioprio class (see ionice(1) manpage)' 348complete -f -c btrfs -n'__btrfs_command_groups scrub resume' -s n -d'Set ioprio classdata (see ionice(1) manpage)' 349# btrfs scrub status 350complete -f -c btrfs -n'__btrfs_command_groups scrub status' -s d -d'Stats per DEVICE' 351complete -f -c btrfs -n'__btrfs_command_groups scrub status' -s R -d'Print raw stats' 352 353# btrfs rescue 354complete -f -c btrfs -n$rescue -a chunk-recover -d'Recover the chunk tree by scanning the devices one by one.' 355complete -f -c btrfs -n$rescue -a super-recover -d'Recover bad superblocks from good copies' 356complete -f -c btrfs -n$rescue -a zero-log -d'Clear the tree log. Usable if it\'s corrupted and prevents mount.' 357complete -f -c btrfs -n$rescue -a fix-device-size -d'Re-align device and super block sizes' 358complete -f -c btrfs -n$rescue -a clear-ino-cache -d'Remove leftover items pertaining to the deprecated inode cache feature' 359complete -f -c btrfs -n$rescue -a clear-space-cache -d'Completely remove the on-disk data of free space cache of given version' 360complete -f -c btrfs -n$rescue -a clear-uuid-tree -d'Clear the UUID tree' 361# btrfs rescue chunk-recover 362complete -f -c btrfs -n'__btrfs_command_groups rescue chunk-recover' -s y -d'Assume an answer of YES to all questions' 363complete -f -c btrfs -n'__btrfs_command_groups rescue chunk-recover' -s v -d'Verbose mode' 364# btrfs rescue super-recover 365complete -f -c btrfs -n'__btrfs_command_groups rescue super-recover' -s y -d'Assume an answer of YES to all questions' 366complete -f -c btrfs -n'__btrfs_command_groups rescue super-recover' -s v -d'Verbose mode' 367 368# btrfs inspect-internal 369complete -f -c btrfs -n$inspect_internal -a inode-resolve -d'Get file system paths for the given inode' 370complete -f -c btrfs -n$inspect_internal -a logical-resolve -d'Get file system paths for the given logical address' 371complete -f -c btrfs -n$inspect_internal -a subvolid-resolve -d'Get file system paths for the given subvolume ID.' 372complete -f -c btrfs -n$inspect_internal -a rootid -d'Get tree ID of the containing subvolume of path.' 373complete -f -c btrfs -n$inspect_internal -a min-dev-size -d'Get the minimum size the device can be shrunk to. (Default: 1)' 374complete -f -c btrfs -n$inspect_internal -a dump-tree -d'Dump tree structures from a given device' 375complete -f -c btrfs -n$inspect_internal -a dump-super -d'Dump superblock from a device in a textual form' 376complete -f -c btrfs -n$inspect_internal -a tree-stats -d'Print various stats for trees' 377complete -f -c btrfs -n$inspect_internal -a list-chunks -d'Enumerate chunks on all devices' 378complete -f -c btrfs -n$inspect_internal -a map-swapfile -d'Find device-specific physical offset of file that can be used for hibernation' 379# btrfs inspect-internal inode-resolve 380complete -f -c btrfs -n'__btrfs_command_groups inspect-internal inode-resolve' -s v -d'Verbose mode' 381# btrfs inspect-internal logical-resolve 382complete -f -c btrfs -n'__btrfs_command_groups inspect-internal logical-resolve' -s P -d'Skip the path resolving and print the inodes instead' 383complete -f -c btrfs -n'__btrfs_command_groups inspect-internal logical-resolve' -s v -d'Verbose mode' 384complete -f -c btrfs -n'__btrfs_command_groups inspect-internal logical-resolve' -s s -d'Set inode container\'s SIZE' 385# btrfs inspect-internal min-dev-size 386complete -f -c btrfs -n'__btrfs_command_groups inspect-internal min-dev-size' -l id -d'Specify the DEVICE-ID to query' 387# btrfs inspect-internal dump-tree 388complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -s e -l extents -d'Print only extent info: extent and device trees' 389complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -s d -l device -d'Print only device info: tree root, chunk and device trees' 390complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -s r -l roots -d'Print only short root node info' 391complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -s R -l backups -d'Print short root node info and backup root info' 392complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -s u -l uuid -d'Print only the uuid tree' 393complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -s b -l block -r -d'Print info from the specified BLOCK only' 394complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -s t -l tree -r -d'Print only tree with the given ID' 395complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -l follow -d'Use with -b, to show all children tree blocks of <block_num>' 396complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -l noscan -d'Do not scan the devices from the filesystem' 397complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -l bfs -d'Breadth-first traversal of the trees, print nodes, then leaves' 398complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -l dfs -d'Depth-first traversal of the trees' 399complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -l hide-names -d'Print placeholder instead of names' 400complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -l csum-headers -d'Print b-tree node checksums in headers' 401complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-tree' -l csum-items -d'Print checksums stored in checksum items' 402 403# btrfs inspect-internal dump-super 404complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-super' -s f -l full -d'Print full superblock information, backup roots etc.' 405complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-super' -s a -l all -d'Print information about all superblocks' 406complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-super' -s s -l super -d'Specify which SUPER-BLOCK copy to print out' -ra'{0,1,2}' 407complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-super' -s F -l force -d'Attempt to dump superblocks with bad magic' 408complete -f -c btrfs -n'__btrfs_command_groups inspect-internal dump-super' -l bytenr -d'Specify alternate superblock OFFSET' 409# btrfs inspect-internal logical-resolve 410complete -f -c btrfs -n'__btrfs_command_groups logical-resolve' -s P -d'Print inodes instead of resolving paths' 411complete -f -c btrfs -n'__btrfs_command_groups logical-resolve' -s o -d'Ignore offsets, find all references to an extent' 412complete -f -c btrfs -n'__btrfs_command_groups logical-resolve' -s s -r -d'Set internal buffer size for storing file names' 413# btrfs inspect-internal tree-stats 414complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -s b -d'Show raw numbers in bytes' 415# btrfs inspect-internal list-chunks 416complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l sort -ra'devid pstart lstart usage length' -d'Sort by a column (ascending)' 417complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l raw -d'Show raw numbers in bytes' 418complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l human-readable -d'Show human friendly numbers, base 1024' 419complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 420complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 421complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l kbytes -d'Show sizes in KiB, or kB with --si' 422complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l mbytes -d'Show sizes in MiB, or MB with --si' 423complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l gbytes -d'Show sizes in GiB, or GB with --si' 424complete -f -c btrfs -n'__btrfs_command_groups inspect-internal list-chunks' -l tbytes -d'Show sizes in TiB, or TB with --si' 425# btrfs inspect-internal map-swapfile 426complete -f -c btrfs -n'__btrfs_command_groups inspect-internal map-swapfile' -l resume-offset -s r -d'Print the value suitable as resume offset for /sys/power/resume_offset.' 427# btrfs inspect-internal tree-stats 428complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -s t -r -d'Print stats only for the given treeid' 429complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -l raw -s b -d'Show raw numbers in bytes' 430complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -l human-readable -d'Show human friendly numbers, base 1024' 431complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 432complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 433complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -l kbytes -d'Show sizes in KiB, or kB with --si' 434complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -l mbytes -d'Show sizes in MiB, or MB with --si' 435complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -l gbytes -d'Show sizes in GiB, or GB with --si' 436complete -f -c btrfs -n'__btrfs_command_groups inspect-internal tree-stats' -l tbytes -d'Show sizes in TiB, or TB with --si' 437 438# btrfs property 439complete -f -c btrfs -n$property -a get -d'Get a property value of a btrfs object' 440complete -f -c btrfs -n$property -a set -d'Set a property on a btrfs object' 441complete -f -c btrfs -n$property -a list -d'Lists available properties with their descriptions for the given object' 442# btrfs property get 443complete -f -c btrfs -n'__btrfs_command_groups property get' -s t -d'List properties for the given object type' -ra'{inode,subvol,filesystem,device}' 444# btrfs property set 445complete -f -c btrfs -n'__btrfs_command_groups property set' -s t -d'List properties for the given object type' -ra'{inode,subvol,filesystem,device}' 446# btrfs property list 447complete -f -c btrfs -n'__btrfs_command_groups property list' -s t -d'List properties for the given object type' -ra'{inode,subvol,filesystem,device}' 448 449# btrfs quota 450complete -f -c btrfs -n$quota -a enable -d'Enable subvolume quota support for a filesystem.' 451complete -f -c btrfs -n$quota -a disable -d'Disable subvolume quota support for a filesystem.' 452complete -f -c btrfs -n$quota -a rescan -d'Trash all qgroup numbers and scan the metadata again with the current config.' 453# btrfs quota enable 454complete -f -c btrfs -n'__btrfs_command_groups quota enable' -s s -l simple -d'Use simple quotas' 455# btrfs quota rescan 456complete -f -c btrfs -n'__btrfs_command_groups quota rescan' -s s -l status -d'Show status of a running rescan operation' 457complete -f -c btrfs -n'__btrfs_command_groups quota rescan' -s w -l wait -d'Wait for rescan operation to finish' 458complete -f -c btrfs -n'__btrfs_command_groups quota rescan' -s W -l wait-norescan -d'Wait for rescan to finish without starting it' 459 460# btrfs qgroup 461complete -f -c btrfs -n$qgroup -a assign -d'Assign SRC as the child qgroup of DST' 462complete -f -c btrfs -n$qgroup -a remove -d'Remove a child qgroup SRC from DST.' 463complete -f -c btrfs -n$qgroup -a create -d'Create a subvolume quota group.' 464complete -f -c btrfs -n$qgroup -a destroy -d'Destroy a quota group.' 465complete -f -c btrfs -n$qgroup -a show -d'Show subvolume quota groups.' 466complete -f -c btrfs -n$qgroup -a clear-stale -d'Clear all stale qgroups whose subvolume does not exist' 467complete -f -c btrfs -n$qgroup -a limit -d'Set the limits a subvolume quota group.' 468# btrfs qgroup assign 469complete -f -c btrfs -n'__btrfs_command_groups qgroup assign' -l rescan -d'Schedule qutoa rescan if needed' 470complete -f -c btrfs -n'__btrfs_command_groups qgroup assign' -l no-rescan -d'Don\'t schedule quota rescan' 471# btrfs qgroup show 472complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -s p -d'Print parent qgroup id' 473complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -s c -d'Print child qgroup id' 474complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -s r -d'Print limit of referenced size of qgroup' 475complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -s e -d'Print limit of exclusive size of qgroup' 476complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -s F -d'List all qgroups including ancestral qgroups' 477complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -s f -d'List all qgroups excluding ancestral qgroups' 478complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l raw -d'Show raw numbers in bytes' 479complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l human-readable -d'Show human friendly numbers, base 1024' 480complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l iec -d'Use 1024 as a base (KiB, MiB, GiB, TiB)' 481complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l si -d'Use 1000 as a base (kB, MB, GB, TB)' 482complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l kbytes -d'Show sizes in KiB, or kB with --si' 483complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l mbytes -d'Show sizes in MiB, or MB with --si' 484complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l gbytes -d'Show sizes in GiB, or GB with --si' 485complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l tbytes -d'Show sizes in TiB, or TB with --si' 486complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l sort -d'List qgroups sorted by specified items' -a'{qgroupid,rfer,excl,max_rfer,max_excl}' 487complete -f -c btrfs -n'__btrfs_command_groups qgroup show' -l sync -d'Force sync of the filesystem before getting info' 488# btrfs qgroup limit 489complete -f -c btrfs -n'__btrfs_command_groups qgroup limit' -s c -d'Limit amount of data after compression' 490complete -f -c btrfs -n'__btrfs_command_groups qgroup limit' -s e -d'Limit space exclusively assigned to this qgroup' 491 492# btrfs replace 493complete -f -c btrfs -n$replace -a start -d'Replace device of a btrfs filesystem.' 494complete -f -c btrfs -n$replace -a status -d'Print status and progress information of a running device replace' 495complete -f -c btrfs -n$replace -a cancel -d'Cancel a running device replace operation.' 496# btrfs replace start 497complete -f -c btrfs -n'__btrfs_command_groups replace start' -s r -d'Only read from <srcdev> if no other zero-defect mirror exists' 498complete -f -c btrfs -n'__btrfs_command_groups replace start' -s f -d'Force using and overwriting <targetdev>' 499complete -f -c btrfs -n'__btrfs_command_groups replace start' -s B -d'Do not background' 500complete -f -c btrfs -n'__btrfs_command_groups replace start' -l enqueue -d"Wait if there's another exclusive operation running" 501complete -f -c btrfs -n'__btrfs_command_groups replace start' -s K -l nodiscard -d'Do not perform TRIM on DEVICES' 502# btrfs replace status 503complete -f -c btrfs -n'__btrfs_command_groups replace status' -s1 -d'Only print once until the replace operation finishes'