summaryrefslogtreecommitdiff
path: root/completions/cpio
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2011-02-06 21:26:41 +0100
committerDavid Paleino <dapal@debian.org>2011-02-06 21:26:41 +0100
commit9920a8faedf704420571d8072ccab27e9dac40ba (patch)
tree733edf3b07be06c130d04aaa1884213326722cad /completions/cpio
parentf9748115fb4b2950fb4df7535fb723c4affde078 (diff)
downloadbash-completion-9920a8faedf704420571d8072ccab27e9dac40ba.tar.gz
Imported Upstream version 1.3upstream/1.3
Diffstat (limited to 'completions/cpio')
-rw-r--r--completions/cpio103
1 files changed, 103 insertions, 0 deletions
diff --git a/completions/cpio b/completions/cpio
new file mode 100644
index 00000000..5ead0184
--- /dev/null
+++ b/completions/cpio
@@ -0,0 +1,103 @@
+# bash completion for cpio
+
+have cpio && {
+_cpio_format()
+{
+ COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- "$cur" ) )
+}
+
+_cpio()
+{
+ local cur prev split=false
+
+ COMPREPLY=()
+ _get_comp_words_by_ref -n : cur prev
+
+ _split_longopt && split=true
+
+ # --name value style option
+ case $prev in
+ -H|--format)
+ _cpio_format
+ return 0
+ ;;
+ -E|-F|-I|--file|--pattern-file)
+ _filedir
+ return 0
+ ;;
+ -R|--owner)
+ _usergroup
+ return 0
+ ;;
+ --rsh-command)
+ _compopt_o_filenames
+ COMPREPLY=( $( compgen -c -- "$cur" ) )
+ return 0
+ ;;
+ esac
+
+ $split && return 0
+
+ if [ $COMP_CWORD -eq 1 ]; then
+ COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through \
+ -? --help --license --usage --version' -- "$cur" ) )
+ else
+ case ${COMP_WORDS[1]} in
+ -o|--create)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
+ -L -V -C -H -M -O -F --file --format\
+ --message --null --reset-access-time\
+ --verbose --dot --append --block-size\
+ --dereference --io-size --quiet\
+ --force-local --rsh-command --help\
+ --version' -- "$cur" ) )
+ fi
+ ;;
+ -i|--extract)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
+ -t -s -u -v -B -S -V -C -E -H -M -R -I\
+ -F --file --make-directories\
+ --nonmatching\
+ --preserve-modification-time\
+ --numeric-uid-gid --rename -t --list\
+ --swap-bytes --swap --dot\
+ --unconditional --verbose --block-size\
+ --swap-halfwords --io-size\
+ --pattern-file --format --owner\
+ --no-preserve-owner --message\
+ --force-local --no-absolute-filenames\
+ --sparse --only-verify-crc --quiet\
+ --rsh-command --help\
+ --to-stdout \
+ --version' -- "$cur" ) )
+ fi
+ ;;
+ -p|--pass-through)
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
+ -L -V -R --null --reset-access-time\
+ --make-directories --link --quiet\
+ --preserve-modification-time\
+ --unconditional --verbose --dot\
+ --dereference --owner\
+ --no-preserve-owner --sparse --help\
+ --version' -- "$cur" ) )
+ else
+ _filedir -d
+ fi
+ ;;
+ esac
+ fi
+}
+complete -F _cpio cpio
+}
+
+# Local variables:
+# mode: shell-script
+# sh-basic-offset: 4
+# sh-indent-comment: t
+# indent-tabs-mode: nil
+# End:
+# ex: ts=4 sw=4 et filetype=sh