Archive : Update unarchive checks for simple format.
This commit is contained in:
parent
4ce33a429d
commit
b44964a436
|
@ -273,12 +273,12 @@
|
||||||
function unarchive() {
|
function unarchive() {
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local targets=(''${@})
|
local targets=(''${@})
|
||||||
[[ "''${targets}" = "" ]] && targets=$(_ls_archive)
|
[[ "''${targets}" = "" ]] && targets=$(_ls_archive_compressed)
|
||||||
|
|
||||||
process() {
|
process() {
|
||||||
# Validate.
|
# Validate.
|
||||||
# _archive_check "''${target}" || return 1
|
# _archive_check "''${target}" || return 1
|
||||||
if ! _is_archive "''${target}"; then
|
if ! _is_compressed_archive "''${target}"; then
|
||||||
_iterate_skip "Not an archive."
|
_iterate_skip "Not an archive."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -404,6 +404,13 @@
|
||||||
[[ "''${out}" != "" ]]
|
[[ "''${out}" != "" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if file is a compressed archive.
|
||||||
|
function _is_compressed_archive() {
|
||||||
|
local out=$(echo "''${*}" | grep -E ''${_archive_pattern_compressed})
|
||||||
|
|
||||||
|
[[ "''${out}" != "" ]]
|
||||||
|
}
|
||||||
|
|
||||||
# List all archives.
|
# List all archives.
|
||||||
function _ls_archive() {
|
function _ls_archive() {
|
||||||
ls | grep -E ''${_archive_pattern}
|
ls | grep -E ''${_archive_pattern}
|
||||||
|
@ -414,6 +421,11 @@
|
||||||
ls | grep -E ''${_archive_pattern_fast}
|
ls | grep -E ''${_archive_pattern_fast}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# List fast archives.
|
||||||
|
function _ls_archive_compressed() {
|
||||||
|
ls | grep -E ''${_archive_pattern_compressed}
|
||||||
|
}
|
||||||
|
|
||||||
# Filter input for archives only.
|
# Filter input for archives only.
|
||||||
function _filter_archive() {
|
function _filter_archive() {
|
||||||
grep -E ''${_archive_pattern}
|
grep -E ''${_archive_pattern}
|
||||||
|
|
Loading…
Reference in a new issue