mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-06-26 15:01:31 +02:00
batpipe: Add support for *.gz files
This commit is contained in:
parent
9072ab47a1
commit
988780bce9
@ -26,7 +26,7 @@ Like [lesspipe](https://github.com/wofr06/lesspipe), `batpipe` is designed to wo
|
||||
| Directories | `ls` |
|
||||
| `*.tar`, `*.tar.gz` | `tar` |
|
||||
| `*.zip`, `*.jar` | `unzip` |
|
||||
|
||||
| `*.gz` | `gunzip` |
|
||||
|
||||
|
||||
## External Viewers
|
||||
|
@ -109,7 +109,7 @@ fi
|
||||
# Viewers:
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
BATPIPE_VIEWERS=("ls" "tar" "unzip")
|
||||
BATPIPE_VIEWERS=("ls" "tar" "unzip" "gunzip")
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@ -171,6 +171,24 @@ viewer_unzip_process() {
|
||||
fi
|
||||
}
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
viewer_gunzip_supports() {
|
||||
command -v "gunzip" &> /dev/null || return 1
|
||||
[[ -z "$3" ]] || return 1
|
||||
|
||||
case "$2" in
|
||||
*.gz) return 0 ;;
|
||||
esac
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
viewer_gunzip_process() {
|
||||
gunzip -k -c "$1"
|
||||
return $?
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Functions:
|
||||
# -----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user