2006-11-02 23:55:48 +00:00
|
|
|
|
|
|
|
function __fish_complete_tar -d "Peek inside of archives and list all files"
|
|
|
|
|
2018-04-13 15:19:01 +00:00
|
|
|
set -l args (commandline -poc)
|
|
|
|
while count $args >/dev/null
|
|
|
|
switch $args[1]
|
|
|
|
case '-*f' '--file'
|
|
|
|
set -e args[1]
|
|
|
|
if test -f $args[1]
|
2018-04-28 15:59:53 +00:00
|
|
|
set -l file_list (tar -atf $args[1] 2> /dev/null)
|
2018-04-13 15:19:01 +00:00
|
|
|
if test -n "$file_list"
|
|
|
|
printf (_ "%s\tArchived file\n") $file_list
|
|
|
|
end
|
|
|
|
return
|
2017-01-05 18:11:38 +00:00
|
|
|
end
|
2018-04-13 15:19:01 +00:00
|
|
|
case '*'
|
|
|
|
set -e args[1]
|
|
|
|
continue
|
2016-11-28 05:27:22 +00:00
|
|
|
end
|
|
|
|
end
|
2006-11-02 23:55:48 +00:00
|
|
|
end
|