mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Add command specific completions for unrar command (No switches yet, only commands and files in archive)
darcs-hash:20061102235727-ac50b-7b7638289be4de52b4e3e3d109ad3167b7285023.gz
This commit is contained in:
parent
bedf8ea55e
commit
c41986a63f
2 changed files with 36 additions and 0 deletions
15
share/completions/unrar.fish
Normal file
15
share/completions/unrar.fish
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
# Peek inside of archives and list all files
|
||||
complete -c unrar -a "(__fish_complete_unrar)"
|
||||
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a e -d (N_ "Extract files to current directory")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a l -d (N_ "List archive" )
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a lt -d (N_ "List archive (technical)" )
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a lb -d (N_ "List archive (bare)" )
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a p -d (N_ "Print file to stdout")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a t -d (N_ "Test archive files")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a v -d (N_ "Verbosely list archive")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a vt -d (N_ "Verbosely list archive (technical)")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a vb -d (N_ "Verbosely list archive (bare)")
|
||||
complete -x -c unrar -n '__fish_use_subcommand' -a x -d (N_ "Extract files with full path")
|
||||
|
21
share/functions/__fish_complete_unrar.fish
Normal file
21
share/functions/__fish_complete_unrar.fish
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
function __fish_complete_unrar -d "Peek inside of archives and list all files"
|
||||
|
||||
set -l cmd (commandline -poc)
|
||||
set -e cmd[1]
|
||||
for i in $cmd
|
||||
switch $i
|
||||
case '-*'
|
||||
continue
|
||||
|
||||
case '*.rar'
|
||||
if test -f $i
|
||||
set -l file_list (unrar vb $i)
|
||||
printf (_ "%s\tArchived file\n") $file_list
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in a new issue