From 612cec047f7726f5b5f974b365894de4a58aef78 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 8 Oct 2008 11:37:34 +0000 Subject: Nikolai Weibull: 25828: new rm completion unposted: note some new features in NEWS --- Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_rm | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Completion/Unix/Command/_rm (limited to 'Completion') diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index c8d935bd5..2a96ad6b1 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -164,6 +164,7 @@ _rcs _renice _ri _rlogin +_rm _rrdtool _rsync _rubber diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm new file mode 100644 index 000000000..4209134b0 --- /dev/null +++ b/Completion/Unix/Command/_rm @@ -0,0 +1,41 @@ +#compdef rm + +declare -a opts args +args=( + '(-f --force)'{-f,--force}'[ignore nonexistent files, never prompt]' + '(-I --interactive)-i[prompt before every removal]' + '(-r -R --recursive)'{-r,-R,--recursive}'[remove directories and their contents recursively]' + '*:files:->file' +) +if _pick_variant gnu=gnu unix --help; then + opts+=(-S) + args+=( + '(-i --interactive)-I[prompt when removing many files]' + '(-i -I)--interactive=-[prompt under given condition (defaulting to always)]::when:((once\:"prompt when removing many files" + always\:"prompt before every removal"))' + '--one-file-system[stay within filesystems of files given as arguments]' + '( --preserve-root)--no-preserve-root[do not treat / specially]' + '(--no-preserve-root )--preserve-root[do not remove / (default)]' + '(-v --verbose)'{-v,--verbose}'[explain what is being done]' + '(- *)--help[display help message and exit]' + '(- *)--version[output version information and exit]' + ) +else + args=(${args:#*--(force|recursive)\[*}) +fi + +local curcontext=$curcontext state line ret=1 +declare -A opt_args + +_arguments -C $opts \ + $args && ret=0 + +case $state in + (file) + declare -a ignored + ignored=(${line//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + _path_files -F ignored && ret=0 + ;; +esac + +return $ret -- cgit 1.4.1