/etc/bash_completion.d/pmount is in pmount 0.9.23-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | #-*- mode: shell-script;-*-
#
# Bash Completion snippet for the pmount command
# Copyright (c) Eduard Bloch, 2009-2011
#
# Supports most (all?) of the possible option sets of version 0.9.18 except of
# too many device/directory arguments, the charset search can also be improved
#
# Inputs:
# $1 -- name of the command whose arguments are being completed
# $2 -- word being completed
# $3 -- word preceding the word being completed
# $COMP_LINE -- current command line
# $COMP_PONT -- cursor position
# $COMP_WORDS -- array containing individual words in the current
# command line
# $COMP_CWORD -- index into ${COMP_WORDS} of the word containing the
# current cursor position
# Output:
# COMPREPLY array variable contains possible completions
have pmount &&
_pmount() {
local cur prev options devices fslist
options=' -r --read-only -w --read-write -s --sync -A --noatime -e --exec \
-t filesystem --type filesystem -c charset --charset charset -u umask \
--umask umask --dmask dmask --fmask fmask -p file --passphrase file \
-h --help -d --debug -V --version'
fslist=' ascii cp1250 cp1251 cp1255 cp437 cp737 cp775 cp850 cp852 cp855 cp857 cp860 cp861 cp862 cp863 cp864 cp865 cp866 cp869 cp874 cp932 cp936 cp949 cp950 euc-jp iso8859-1 iso8859-13 iso8859-14 iso8859-15 iso8859-2 iso8859-3 iso8859-4 iso8859-5 iso8859-6 iso8859-7 iso8859-9 koi8-r koi8-ru koi8-u utf8'
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
case "$prev" in
-@(t|-type))
COMPREPLY=( $( grep "^[[:space:]]$cur" /proc/filesystems ) )
return 0
;;
-@(c|-charset))
COMPREPLY=( $( compgen -W "$fslist" -- $cur ) )
return 0
;;
-@(u|d|-umask|-dmask))
COMPREPLY=( ${cur}0 ${cur}1 ${cur}2 ${cur}3 ${cur}4 ${cur}5 ${cur}6 ${cur}7 )
return 0
;;
-@(p|-passphrase))
_filedir
return 0
;;
esac
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
devices="$( command ls $(grep -v '^[[:space:]]*#' /etc/pmount.allow ) $(grep 1 /sys/block/*/removable | sed -e 's,/sys/block/,/dev/,;s,/removable:1,*,') 2>/dev/null | sort -u | sed -e 's,\(^/dev/\)\(.*\),\1\2 \2,' ; grep $mdir /proc/mounts | sed -e 's,.*\($mdir/[^ ]*\).*,\1,' )"
COMPREPLY=( $( compgen -W "$devices" -- $cur ) )
fi
return 0
}
have pumount &&
_pumount() {
local cur prev options devices mdir
mdir="$(readlink -f /media)"
options=' -l --luks-force -h --help -d --debug --version'
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
else
devices="$( grep $mdir /proc/mounts | sed -e 's,.*/$mdir/,,;s,\ .*,,;s,\(.*\),\1\n/dev/\1,;s,/dev//dev,/dev,' )"
COMPREPLY=( $( compgen -W "$devices" -- $cur ) )
fi
return 0
}
[ "$have" ] && complete -F _pmount $filenames pmount
[ "$have" ] && complete -F _pumount $filenames pumount
|