fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerMerge branch 'completions-to-use-expanded-tokens'a9618477e

master
2.4 KiB49 linesraw
1complete -c unzip -s p -d "extract files to pipe, no messages"
2complete -c unzip -s f -d "freshen existing files, create none"
3complete -c unzip -s u -d "update files, create if necessary"
4complete -c unzip -s v -d "list verbosely/show version info"
5complete -c unzip -s x -d "exclude files that follow (in xlist)"
6complete -c unzip -s l -d "list files (short format)"
7complete -c unzip -s t -d "test compressed archive datamodifiers:"
8complete -c unzip -s z -d "display archive comment only"
9complete -c unzip -s T -d "timestamp archive to latest"
10complete -c unzip -s d -d "extract files into dir" -xa '(__fish_complete_directories)'
11complete -c unzip -s n -d "never overwrite existing files"
12complete -c unzip -s o -d "overwrite files WITHOUT prompting"
13complete -c unzip -s q -d "quiet mode"
14complete -c unzip -o qq -d "quieter mode"
15complete -c unzip -s a -d "auto-convert any text files"
16complete -c unzip -s U -d "use escapes for all non-ASCII Unicode"
17complete -c unzip -o UU -d "ignore any Unicode fields"
18complete -c unzip -s j -d "junk paths (do not make directories)"
19complete -c unzip -s aa -d "treat ALL files as text"
20complete -c unzip -s C -d "match filenames case-insensitively"
21complete -c unzip -s L -d "make (some) names lowercase"
22complete -c unzip -s X -d "restore UID/GID info"
23complete -c unzip -s V -d "retain VMS version numbers"
24complete -c unzip -s K -d "keep setuid/setgid/tacky permissions"
25complete -c unzip -s M -d "pipe through `more` pager"
26# Some distros have -O and -I, some don't.
27# Even "-h" might not be available.
28if unzip -h 2>/dev/null | string match -rq -- -O
29    complete -c unzip -s O -d "specify a character encoding for DOS, Windows and OS/2 archives" -x -a "(__fish_print_encodings)"
30end
31if unzip -h 2>/dev/null | string match -rq -- -I
32    complete -c unzip -s I -d "specify a character encoding for UNIX and other archives" -x -a "(__fish_print_encodings)"
33end
34
35# Debian version of unzip
36if unzip -v 2>/dev/null | string match -eq Debian
37
38    # the first non-switch argument should be the zipfile
39    complete -c unzip -n "__fish_is_nth_token 1" -k -xa '(__fish_complete_suffix .zip .jar .aar)'
40
41    # Files thereafter are either files to include or exclude from the operation
42    complete -c unzip -n 'not __fish_is_nth_token 1' -xa '(unzip -l (__fish_first_token) 2>/dev/null | string replace -r --filter ".*:\S+\s+(.*)" "\$1")'
43
44else
45
46    # all tokens should be zip files
47    complete -c unzip -k -xa '(__fish_complete_suffix .zip .jar .aar)'
48
49end