2006-11-03 07:55:48 +08:00
|
|
|
|
|
|
|
function __fish_complete_tar -d "Peek inside of archives and list all files"
|
|
|
|
|
2018-04-13 23:19:01 +08: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 23:59:53 +08:00
|
|
|
set -l file_list (tar -atf $args[1] 2> /dev/null)
|
2018-04-13 23:19:01 +08:00
|
|
|
if test -n "$file_list"
|
|
|
|
printf (_ "%s\tArchived file\n") $file_list
|
|
|
|
end
|
|
|
|
return
|
2017-01-06 02:11:38 +08:00
|
|
|
end
|
2018-04-13 23:19:01 +08:00
|
|
|
case '*'
|
|
|
|
set -e args[1]
|
|
|
|
continue
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
|
|
|
end
|
2006-11-03 07:55:48 +08:00
|
|
|
end
|