mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-01 04:30:37 +02:00
Add archive.plugin.zsh
This commit is contained in:
parent
97c0384169
commit
c7ea416692
1 changed files with 28 additions and 0 deletions
28
plugins/archive/archive.plugin.zsh
Normal file
28
plugins/archive/archive.plugin.zsh
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
alias a=archive
|
||||||
|
|
||||||
|
archive() {
|
||||||
|
if (( $# == 0 )); then
|
||||||
|
cat <<-'EOF' >&2
|
||||||
|
Usage: archive [file ...]
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
while (( $# > 0 )); do
|
||||||
|
if [[ ! -f "$1" ]]; then
|
||||||
|
echo "archive: '$1' is not a valid file" >&2
|
||||||
|
shift
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
(*.7z) 7z l "$1" ;;
|
||||||
|
(*.rar) unrar l "$1" ;;
|
||||||
|
(*.tar|*.tar.bz2|*.tar.gz|*.tar.lzma|*.tar.xz) tar tf "$1" ;;
|
||||||
|
(*.zip) unzip -l "$1" ;;
|
||||||
|
(*)
|
||||||
|
echo "archive: '$1' cannot be listed" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue