mirror of
https://github.com/notwa/rc
synced 2024-06-29 02:17:12 -07:00
reformat archive scripts to better fit in
This commit is contained in:
parent
bf684554e6
commit
bd81dc0b28
12
sh/archive
12
sh/archive
|
@ -1,3 +1,10 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# YES_ZSH
|
||||||
|
# NO_BASH
|
||||||
|
# NO_DASH
|
||||||
|
# NO_ASH
|
||||||
|
|
||||||
|
archive() {
|
||||||
#
|
#
|
||||||
# Creates archive file
|
# Creates archive file
|
||||||
#
|
#
|
||||||
|
@ -5,8 +12,6 @@
|
||||||
# Matt Hamilton <m@tthamilton.com>
|
# Matt Hamilton <m@tthamilton.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
# function archive {
|
|
||||||
|
|
||||||
local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin _zstd_bin
|
local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin _zstd_bin
|
||||||
|
|
||||||
if (( $# < 2 )); then
|
if (( $# < 2 )); then
|
||||||
|
@ -71,5 +76,6 @@ case "${archive_name}" in
|
||||||
(*.lzma) print "\n.lzma is only useful for single files, and does not capture permissions. Use .tar.lzma" ;;
|
(*.lzma) print "\n.lzma is only useful for single files, and does not capture permissions. Use .tar.lzma" ;;
|
||||||
(*) print "\nunknown archive type for archive: ${archive_name}" ;;
|
(*) print "\nunknown archive type for archive: ${archive_name}" ;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
# }
|
[ -n "${preload+-}" ] || archive "$@"
|
||||||
|
|
13
sh/lsarchive
13
sh/lsarchive
|
@ -1,3 +1,10 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# YES_ZSH
|
||||||
|
# NO_BASH
|
||||||
|
# NO_DASH
|
||||||
|
# NO_ASH
|
||||||
|
|
||||||
|
lsarchive() {
|
||||||
#
|
#
|
||||||
# Lists the contents of archives.
|
# Lists the contents of archives.
|
||||||
#
|
#
|
||||||
|
@ -5,8 +12,6 @@
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
# function lsarchive {
|
|
||||||
|
|
||||||
local verbose
|
local verbose
|
||||||
|
|
||||||
if (( $# == 0 )); then
|
if (( $# == 0 )); then
|
||||||
|
@ -18,6 +23,7 @@ options:
|
||||||
|
|
||||||
Report bugs to <sorin.ionescu@gmail.com>.
|
Report bugs to <sorin.ionescu@gmail.com>.
|
||||||
EOF
|
EOF
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
|
if [[ "$1" == "-v" || "$1" == "--verbose" ]]; then
|
||||||
|
@ -58,5 +64,6 @@ while (( $# > 0 )); do
|
||||||
|
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# }
|
[ -n "${preload+-}" ] || lsarchive "$@"
|
||||||
|
|
13
sh/unarchive
13
sh/unarchive
|
@ -1,3 +1,10 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
# YES_ZSH
|
||||||
|
# NO_BASH
|
||||||
|
# NO_DASH
|
||||||
|
# NO_ASH
|
||||||
|
|
||||||
|
unarchive() {
|
||||||
#
|
#
|
||||||
# Extracts the contents of archives.
|
# Extracts the contents of archives.
|
||||||
#
|
#
|
||||||
|
@ -5,8 +12,6 @@
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
# function unarchive {
|
|
||||||
|
|
||||||
local remove_archive
|
local remove_archive
|
||||||
local success
|
local success
|
||||||
local file_name
|
local file_name
|
||||||
|
@ -23,6 +28,7 @@ options:
|
||||||
|
|
||||||
Report bugs to <sorin.ionescu@gmail.com>.
|
Report bugs to <sorin.ionescu@gmail.com>.
|
||||||
EOF
|
EOF
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
remove_archive=1
|
remove_archive=1
|
||||||
|
@ -107,5 +113,6 @@ while (( $# > 0 )); do
|
||||||
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# }
|
[ -n "${preload+-}" ] || unarchive "$@"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user