From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH 01/33] bash-completion: add mount and umount
Date: Sat, 13 Apr 2013 20:54:29 +0100 [thread overview]
Message-ID: <1365882901-11429-2-git-send-email-kerolasa@iki.fi> (raw)
In-Reply-To: <1365882901-11429-1-git-send-email-kerolasa@iki.fi>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
bash-completion/mount | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++
bash-completion/umount | 60 ++++++++++++++++++++++++++++++++++
2 files changed, 147 insertions(+)
create mode 100644 bash-completion/mount
create mode 100644 bash-completion/umount
diff --git a/bash-completion/mount b/bash-completion/mount
new file mode 100644
index 0000000..2303cb7
--- /dev/null
+++ b/bash-completion/mount
@@ -0,0 +1,87 @@
+_mount_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--types')
+ local TYPES
+ TYPES="
+adfs noadfs hfsplus nohfsplus smbfs nosmbfs
+affs noaffs hpfs nohpfs squashfs nosquashfs
+autofs noautofs iso9660 noiso9660 sysv nosysv
+cifs nocifs jfs nojfs tmpfs notmpfs
+coda nocoda minix nominix ubifs noubifs
+coherent nocoherent msdos nomsdos udf noudf
+cramfs nocramfs ncpfs noncpfs ufs noufs
+debugfs nodebugfs nfs nonfs umsdos noumsdos
+devpts nodevpts nfs4 nonfs4 usbfs nousbfs
+efs noefs ntfs nontfs vfat novfat
+ext noext proc noproc xenix noxenix
+ext2 noext2 qnx4 noqnx4 xfs noxfs
+ext3 noext3 ramfs noramfs xiafs noxiafs
+ext4 noext4 reiserfs noreiserfs
+hfs nohfs romfs noromfs
+"
+ COMPREPLY=( $(compgen -W "$TYPES" -- $cur) )
+ return 0
+ ;;
+ '-L'|'--label')
+ local LABELS
+ LABELS="$(lsblk -o LABEL -nr)"
+ COMPREPLY=( $(compgen -W "$LABELS" -- $cur) )
+ return 0
+ ;;
+ '-U'|'--uuid')
+ local UUIDS
+ UUIDS="$(lsblk -o UUID -nr)"
+ COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) )
+ return 0
+ ;;
+ '-h'|'--help'|'-V'|'--version')
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS=" --all
+ --no-canonicalize
+ --fake
+ --fork
+ --fstab
+ --help
+ --internal-only
+ --show-labels
+ --no-mtab
+ --options
+ --test-opts
+ --read-only
+ --types
+ --source
+ --target
+ --verbose
+ --version
+ --read-write
+ --label
+ --uuid
+ --bind
+ --move
+ --rbind
+ --make-shared
+ --make-slave
+ --make-private
+ --make-unbindable
+ --make-rshared
+ --make-rslave
+ --make-rprivate
+ --make-runbindable"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ compopt -o filenames
+ COMPREPLY=( $(compgen -f -- $cur) )
+ return 0
+}
+complete -F _mount_module mount
diff --git a/bash-completion/umount b/bash-completion/umount
new file mode 100644
index 0000000..f178bd7
--- /dev/null
+++ b/bash-completion/umount
@@ -0,0 +1,60 @@
+_umount_module()
+{
+ local cur prev OPTS
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ case $prev in
+ '-t'|'--types')
+ local TYPES
+ TYPES="
+adfs noadfs hfsplus nohfsplus smbfs nosmbfs
+affs noaffs hpfs nohpfs squashfs nosquashfs
+autofs noautofs iso9660 noiso9660 sysv nosysv
+cifs nocifs jfs nojfs tmpfs notmpfs
+coda nocoda minix nominix ubifs noubifs
+coherent nocoherent msdos nomsdos udf noudf
+cramfs nocramfs ncpfs noncpfs ufs noufs
+debugfs nodebugfs nfs nonfs umsdos noumsdos
+devpts nodevpts nfs4 nonfs4 usbfs nousbfs
+efs noefs ntfs nontfs vfat novfat
+ext noext proc noproc xenix noxenix
+ext2 noext2 qnx4 noqnx4 xfs noxfs
+ext3 noext3 ramfs noramfs xiafs noxiafs
+ext4 noext4 reiserfs noreiserfs
+"
+ COMPREPLY=( $(compgen -W "$TYPES" -- $cur) )
+ return 0
+ ;;
+ '-h'|'--help'|'-V'|'--version')
+ return 0
+ ;;
+ esac
+ case $cur in
+ -*)
+ OPTS=" --all
+ --all-targets
+ --no-canonicalize
+ --detach-loop
+ --fake
+ --force
+ --internal-only
+ --no-mtab
+ --lazy
+ --test-opts
+ --recursive
+ --read-only
+ --types
+ --verbose
+ --help
+ --version"
+ COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
+ return 0
+ ;;
+ esac
+ local DEVS_MPOINTS
+ DEVS_MPOINTS="$(mount | awk '{print $1, $3}')"
+ COMPREPLY=( $(compgen -W "$DEVS_MPOINTS" -- $cur) )
+ return 0
+}
+complete -F _umount_module umount
--
1.8.2.1
next prev parent reply other threads:[~2013-04-13 19:55 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-13 19:54 [PATCH 00/33] pull: bash completions, help screens, and file writing Sami Kerola
2013-04-13 19:54 ` Sami Kerola [this message]
2013-04-13 19:54 ` [PATCH 02/33] blkid, hwclock, ldattach: use program_invocation_short_name Sami Kerola
2013-04-13 19:54 ` [PATCH 03/33] utmpdump: add option to write to a file Sami Kerola
2013-04-13 19:54 ` [PATCH 04/33] cfdisk: add long options to the command Sami Kerola
2013-04-26 11:30 ` Karel Zak
2013-04-13 19:54 ` [PATCH 05/33] bash-completion: prefer bash 3.x 'here string' syntax Sami Kerola
2013-04-13 21:59 ` Dave Reisner
2013-04-26 11:38 ` Karel Zak
2013-04-26 12:29 ` Sami Kerola
2013-04-13 19:54 ` [PATCH 06/33] setpriv: allow login and group name option arguments Sami Kerola
2013-04-13 19:54 ` [PATCH 07/33] build-sys: add --disable-setterm to ./configure Sami Kerola
2013-04-26 11:53 ` Karel Zak
2013-04-13 19:54 ` [PATCH 08/33] hexdump: add long options to the command Sami Kerola
2013-04-13 19:54 ` [PATCH 09/33] setsid: exit when control terminal cannot be set Sami Kerola
2013-04-13 19:54 ` [PATCH 10/33] cfdisk: check writing to a file was successful Sami Kerola
2013-04-13 19:54 ` [PATCH 11/33] setpriv: " Sami Kerola
2013-04-13 19:54 ` [PATCH 12/33] agetty: " Sami Kerola
2013-04-13 19:54 ` [PATCH 13/33] pg: " Sami Kerola
2013-04-13 19:54 ` [PATCH 14/33] libblkid: " Sami Kerola
2013-04-13 19:54 ` [PATCH 15/33] libmount: " Sami Kerola
2013-04-13 19:54 ` [PATCH 16/33] include: add close_fd() for noticing write errors before close() Sami Kerola
2013-04-13 19:54 ` [PATCH 17/33] fdformat: check writing to a file descriptor was successful Sami Kerola
2013-04-13 19:54 ` [PATCH 18/33] partx: " Sami Kerola
2013-04-13 19:54 ` [PATCH 19/33] resizepart: " Sami Kerola
2013-04-13 19:54 ` [PATCH 20/33] cfdisk: " Sami Kerola
2013-04-13 19:54 ` [PATCH 21/33] sfdisk: " Sami Kerola
2013-04-13 19:54 ` [PATCH 22/33] wdctl: " Sami Kerola
2013-04-13 19:54 ` [PATCH 23/33] fsck.cramfs: " Sami Kerola
2013-04-13 19:54 ` [PATCH 24/33] fsck.minix: " Sami Kerola
2013-04-13 19:54 ` [PATCH 25/33] mkfs.bfs: " Sami Kerola
2013-04-13 19:54 ` [PATCH 26/33] mkfs.cramfs: unify write check to a file descriptor Sami Kerola
2013-04-13 19:54 ` [PATCH 27/33] mkfs.minix: check writing to a file descriptor was successful Sami Kerola
2013-04-13 19:54 ` [PATCH 28/33] mkswap: unify write check to a file descriptor Sami Kerola
2013-04-13 19:54 ` [PATCH 29/33] swaplabel: check writing to a file descriptor was successful Sami Kerola
2013-04-13 19:54 ` [PATCH 30/33] fallocate: " Sami Kerola
2013-04-13 19:54 ` [PATCH 31/33] setpriv: " Sami Kerola
2013-04-13 19:55 ` [PATCH 32/33] swapon: " Sami Kerola
2013-04-13 19:55 ` [PATCH 33/33] wall: " Sami Kerola
2013-04-17 13:31 ` [PATCH 00/33] pull: bash completions, help screens, and file writing Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1365882901-11429-2-git-send-email-kerolasa@iki.fi \
--to=kerolasa@iki.fi \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox