summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell-completion/addpart25
-rw-r--r--shell-completion/blockdev44
-rw-r--r--shell-completion/delpart23
-rw-r--r--shell-completion/fdformat11
-rw-r--r--shell-completion/fsck36
-rw-r--r--shell-completion/fsck.cramfs18
-rw-r--r--shell-completion/fsck.minix11
-rw-r--r--shell-completion/isosize17
-rw-r--r--shell-completion/mkfs25
-rw-r--r--shell-completion/mkfs.bfs28
-rw-r--r--shell-completion/mkfs.cramfs40
-rw-r--r--shell-completion/mkfs.minix33
-rw-r--r--shell-completion/mkswap35
-rw-r--r--shell-completion/partx38
-rw-r--r--shell-completion/raw17
-rw-r--r--shell-completion/resizepart25
-rw-r--r--shell-completion/swaplabel28
17 files changed, 454 insertions, 0 deletions
diff --git a/shell-completion/addpart b/shell-completion/addpart
new file mode 100644
index 000000000..b6f119a75
--- /dev/null
+++ b/shell-completion/addpart
@@ -0,0 +1,25 @@
+_addpart_module()
+{
+ local cur prev
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $COMP_CWORD in
+ 1)
+ local DEVS=''
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ OPTS="-h --help -V --version $DEVS"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ ;;
+ 2)
+ # FIXME: how to determine next free partition number
+ ;;
+ 3)
+ COMPREPLY=( $(compgen -W "start" -- $cur) )
+ ;;
+ 4)
+ COMPREPLY=( $(compgen -W "length" -- $cur) )
+ ;;
+ esac
+ return 0
+}
+complete -F _addpart_module addpart
diff --git a/shell-completion/blockdev b/shell-completion/blockdev
new file mode 100644
index 000000000..ce986cb45
--- /dev/null
+++ b/shell-completion/blockdev
@@ -0,0 +1,44 @@
+_blockdev_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ OPTS="-h -V -q
+ --report
+ --getsz
+ --setro
+ --setrw
+ --getro
+ --getdiscardzeroes
+ --getss
+ --getpbsz
+ --getiomin
+ --getioopt
+ --getalignoff
+ --getmaxsect
+ --getbsz
+ --setbsz
+ --getsize64
+ --setra
+ --getra
+ --setfra
+ --getfra
+ --flushbufs
+ --rereadpt
+ $DEVS"
+ case $prev in
+ '--setbsz')
+ COMPREPLY=( $(compgen -W "bytes" -- $cur) )
+ return 0
+ ;;
+ '--setbsz'|'--setfra')
+ COMPREPLY=( $(compgen -W "sectors" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _blockdev_module blockdev
diff --git a/shell-completion/delpart b/shell-completion/delpart
new file mode 100644
index 000000000..e3ee40629
--- /dev/null
+++ b/shell-completion/delpart
@@ -0,0 +1,23 @@
+_delpart_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $COMP_CWORD in
+ 1)
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ OPTS="-h --help -V --version $DEVICES"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ ;;
+ 2)
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) )
+ ;;
+ esac
+ return 0
+}
+complete -F _delpart_module delpart
diff --git a/shell-completion/fdformat b/shell-completion/fdformat
new file mode 100644
index 000000000..4ad1c3d05
--- /dev/null
+++ b/shell-completion/fdformat
@@ -0,0 +1,11 @@
+_fdformat_module()
+{
+ local cur OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ DEVS=$(for I in echo /dev/fd*; do if [ -e $I ]; then echo $I; fi; done)
+ OPTS="-n --no-verify -h --help -V --version $DEVS"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _fdformat_module fdformat
diff --git a/shell-completion/fsck b/shell-completion/fsck
new file mode 100644
index 000000000..40b9a13e7
--- /dev/null
+++ b/shell-completion/fsck
@@ -0,0 +1,36 @@
+_fsck_module()
+{
+ local cur prev OPTS DEVS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-b')
+ COMPREPLY=( $(compgen -W "superblock" -- $cur) )
+ return 0
+ ;;
+ '-B')
+ COMPREPLY=( $(compgen -W "blocksize" -- $cur) )
+ return 0
+ ;;
+ '-j')
+ COMPREPLY=( $(compgen -W "external_journal" -- $cur) )
+ return 0
+ ;;
+ '-l'|'-L')
+ COMPREPLY=( $(compgen -W "bad_blocks_file" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-p -n -y -c -f -v -b -B -j -l -L"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS" -- $cur) )
+ return 0
+}
+complete -F _fsck_module fsck
diff --git a/shell-completion/fsck.cramfs b/shell-completion/fsck.cramfs
new file mode 100644
index 000000000..410b084ce
--- /dev/null
+++ b/shell-completion/fsck.cramfs
@@ -0,0 +1,18 @@
+_fsck.cramfs_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ OPTS='-v --verbose -x --destination -h --help -V --version file'
+ case $prev in
+ '-x'|'--destination')
+ compopt -o filenames
+ COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -S ' ' -- $cur) )
+ return 0
+}
+complete -F _fsck.cramfs_module fsck.cramfs
diff --git a/shell-completion/fsck.minix b/shell-completion/fsck.minix
new file mode 100644
index 000000000..6239ae4a2
--- /dev/null
+++ b/shell-completion/fsck.minix
@@ -0,0 +1,11 @@
+_fsck.minix_module()
+{
+ local cur OPTS DEVS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ OPTS="-l -a -r -v -s -m -f -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]} $DEVS" -- $cur) )
+ return 0
+}
+complete -F _fsck.minix_module fsck.minix
diff --git a/shell-completion/isosize b/shell-completion/isosize
new file mode 100644
index 000000000..2b4a49918
--- /dev/null
+++ b/shell-completion/isosize
@@ -0,0 +1,17 @@
+_isosize_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ OPTS='-d --divisor -x --sectors -h --help -V --version'
+ case $prev in
+ '-d'|'--divisor')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+}
+complete -F _isosize_module isosize
diff --git a/shell-completion/mkfs b/shell-completion/mkfs
new file mode 100644
index 000000000..19471195e
--- /dev/null
+++ b/shell-completion/mkfs
@@ -0,0 +1,25 @@
+_mkfs_module()
+{
+ local cur prev OPTS DEVS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--type')
+ FSTYPES=$(for I in /sbin/mkfs.* /usr/sbin/mkfs.*; do if [ -e $I ]; then echo ${I##*mkfs.}; fi; done)
+ COMPREPLY=( $(compgen -W "$FSTYPES" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS='-t --type --verbose -h --help -V --version'
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS /path/to/file" -- $cur) )
+ return 0
+}
+complete -F _mkfs_module mkfs
diff --git a/shell-completion/mkfs.bfs b/shell-completion/mkfs.bfs
new file mode 100644
index 000000000..7a47a76fb
--- /dev/null
+++ b/shell-completion/mkfs.bfs
@@ -0,0 +1,28 @@
+_bfs_module()
+{
+ local cur prev OPTS DEVS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-N'|'--inodes')
+ COMPREPLY=( $(compgen -W "number" -- $cur) )
+ return 0
+ ;;
+ '-V'|'--vname'|'-F'|'--fname')
+ COMPREPLY=( $(compgen -W "name" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS='-N --inodes --vname --fname -v --verbose -h --help -V --version'
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS /path/to/file" -- $cur) )
+ return 0
+}
+complete -F _bfs_module bfs
diff --git a/shell-completion/mkfs.cramfs b/shell-completion/mkfs.cramfs
new file mode 100644
index 000000000..65ee98836
--- /dev/null
+++ b/shell-completion/mkfs.cramfs
@@ -0,0 +1,40 @@
+_mkfs.cramfs_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-b')
+ COMPREPLY=( $(compgen -W "blksize" -- $cur) )
+ return 0
+ ;;
+ '-e')
+ COMPREPLY=( $(compgen -W "edition" -- $cur) )
+ return 0
+ ;;
+ '-N')
+ COMPREPLY=( $(compgen -W "big little host" -- $cur) )
+ return 0
+ ;;
+ '-i')
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+ ;;
+ '-n')
+ COMPREPLY=( $(compgen -W "name" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-h -v -E -b -e -N -i -n -p -s -z"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _mkfs.cramfs_module mkfs.cramfs
diff --git a/shell-completion/mkfs.minix b/shell-completion/mkfs.minix
new file mode 100644
index 000000000..085a0587b
--- /dev/null
+++ b/shell-completion/mkfs.minix
@@ -0,0 +1,33 @@
+_mkfs.minix_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-i')
+ COMPREPLY=( $(compgen -W "inodes" -- $cur) )
+ return 0
+ ;;
+ '-l')
+ COMPREPLY=( $(compgen -W "badblocks-file" -- $cur) )
+ return 0
+ ;;
+ '-n')
+ COMPREPLY=( $(compgen -W "14 30" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-c -i -l -n -1 -2 -3"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEVS
+ while read dev; do DEVS+="$dev " ; done < <(lsblk -pnro name)
+ COMPREPLY=( $(compgen -W "$DEVS" -- $cur) )
+ return 0
+}
+complete -F _mkfs.minix_module mkfs.minix
diff --git a/shell-completion/mkswap b/shell-completion/mkswap
new file mode 100644
index 000000000..30d517cad
--- /dev/null
+++ b/shell-completion/mkswap
@@ -0,0 +1,35 @@
+_mkswap_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-p'|'--pagesize')
+ COMPREPLY=( $(compgen -W "bytes" -- $cur) )
+ return 0
+ ;;
+ '-L'|'--label')
+ COMPREPLY=( $(compgen -W "label" -- $cur) )
+ return 0
+ ;;
+ '-v'|'--swapversion')
+ COMPREPLY=( $(compgen -W "1" -- $cur) )
+ return 0
+ ;;
+ '-U'|--uuid)
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-c --check -f --force -p --pagesize -L --label -v --swapversion -U --uuid -V --version -h --help"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _mkswap_module mkswap
diff --git a/shell-completion/partx b/shell-completion/partx
new file mode 100644
index 000000000..db2eded6a
--- /dev/null
+++ b/shell-completion/partx
@@ -0,0 +1,38 @@
+_partx_module()
+{
+ local cur prev OPTS OUTPUT
+ COMPREPLY=()
+ OUTPUT="NR START END SECTORS SIZE NAME UUID TYPE FLAGS SCHEME"
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-n'|'--nr')
+ return 0
+ ;;
+ '-o'|'--output')
+ # FIXME: how to append to a string with compgen?
+ compopt -o nospace
+ COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
+ return 0
+ ;;
+ '-t'|'--type')
+ # FIXME: some command should list type libblkid knows.
+ COMPREPLY=( $(compgen -W "aix bsd dos gpt mac minix sgi solaris_x86 sun ultrix unixware" -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-a --add -d --delete -s --show -u --update -b --bytes -g --noheadings -n --nr -o --output -P --pairs -r --raw -t --type -v --verbose -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ COMPREPLY=( $(compgen -W "$DEVICES" -- $cur) )
+ return 0
+}
+complete -F _partx_module partx
diff --git a/shell-completion/raw b/shell-completion/raw
new file mode 100644
index 000000000..27f035454
--- /dev/null
+++ b/shell-completion/raw
@@ -0,0 +1,17 @@
+_raw_module()
+{
+ local cur
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $cur in
+ -*)
+ local OPTS
+ OPTS="-q --query -a --all -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "$(for I in /dev/raw/*; do if [ -e $I ]; then echo $I; fi; done)" -- $cur) )
+ return 0
+}
+complete -F _raw_module raw
diff --git a/shell-completion/resizepart b/shell-completion/resizepart
new file mode 100644
index 000000000..b178b529c
--- /dev/null
+++ b/shell-completion/resizepart
@@ -0,0 +1,25 @@
+_resizepart_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ case $COMP_CWORD in
+ 1)
+ local DEV TYPE DEVICES=''
+ while read DEV TYPE; do
+ [ $TYPE = 'disk' ] && DEVICES+="$DEV "
+ done < <(lsblk -pnro name,type)
+ OPTS="-h --help -V --version $DEVICES"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ ;;
+ 2)
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ COMPREPLY=( $(compgen -W "$(cat /sys/block/${prev##*/}/*/partition 2>/dev/null)" -- $cur) )
+ ;;
+ 3)
+ COMPREPLY="length"
+ ;;
+ esac
+ return 0
+}
+complete -F _resizepart_module resizepart
diff --git a/shell-completion/swaplabel b/shell-completion/swaplabel
new file mode 100644
index 000000000..c857d1592
--- /dev/null
+++ b/shell-completion/swaplabel
@@ -0,0 +1,28 @@
+_swaplabel_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-L'|'--label')
+ COMPREPLY=( $(compgen -W "label" -- $cur) )
+ return 0
+ ;;
+ '-U'|'--uuid')
+ COMPREPLY=( $(compgen -W '$(uuidgen)' -- $cur) )
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS="-L --label -U --uuid -h --help -V --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _swaplabel_module swaplabel