mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-13 16:04:08 +08:00
Compare commits
3 Commits
511add4a53
...
b97c92bfd6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b97c92bfd6 | ||
|
|
92aed2e936 | ||
|
|
11cf52e701 |
@ -282,3 +282,30 @@ function omz_urldecode {
|
|||||||
|
|
||||||
echo -E "$decoded"
|
echo -E "$decoded"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The OS is linux
|
||||||
|
function is_linux { [[ "$OSTYPE" == linux* ]]; }
|
||||||
|
# The OS is Android
|
||||||
|
function is_android { [[ "$OSTYPE" == linux-android* ]]; }
|
||||||
|
# The OS is NetBSD
|
||||||
|
function is_netbsd() { [[ "$OSTYPE" == netbsd* ]]; }
|
||||||
|
# The OS is OpenBSD
|
||||||
|
function is_openbsd() { [[ "$OSTYPE" == openbsd* ]]; }
|
||||||
|
# The OS is FreeBSD
|
||||||
|
function is_freebsd() { [[ "$OSTYPE" == freebsd* ]]; }
|
||||||
|
# The OS is macOS (darwin)
|
||||||
|
function is_mac() { [[ "$OSTYPE" == darwin* ]]; }
|
||||||
|
# The OS is macOS (darwin) running on series of ARM-based systems-on-a-chip designed by Apple Inc
|
||||||
|
function is_mac_arm() { is_mac && [[ "$CPUTYPE" == arm64 ]]; }
|
||||||
|
# The OS is macOS (darwin) running on series of Intel (amd64 / x86_64) CPU
|
||||||
|
function is_mac_intel() { is_mac && [[ "$CPUTYPE" == x86_64 ]]; }
|
||||||
|
# The OS is a BSD derivate
|
||||||
|
function is_bsd() { [[ "$OSTYPE" == (darwin|freebsd|openbsd|netbsd|dragonfly)* ]]; }
|
||||||
|
# The OS is Solaris
|
||||||
|
function is_solaris { [[ "$OSTYPE" == solaris* ]]; }
|
||||||
|
# The Platform is Cygwin (Windows)
|
||||||
|
function is_cygwin { [[ "$OSTYPE" == cygwin* ]]; }
|
||||||
|
# The platform is MinGW (Windows)
|
||||||
|
function is_msys { [[ "$OSTYPE" == msys* ]]; }
|
||||||
|
# The OS is Windows
|
||||||
|
function is_windows { [[ "$OSTYPE" == (cygwin|msys)* ]]; }
|
||||||
|
|||||||
@ -77,7 +77,15 @@ EOF
|
|||||||
(*.lzma) unlzma "$full_path" ;;
|
(*.lzma) unlzma "$full_path" ;;
|
||||||
(*.z) uncompress "$full_path" ;;
|
(*.z) uncompress "$full_path" ;;
|
||||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
||||||
(*.rar) unrar x -ad "$full_path" ;;
|
(*.rar)
|
||||||
|
if (( $+commands[unrar] )); then
|
||||||
|
unrar x -ad "$full_path"
|
||||||
|
elif (( $+commands[unar] )); then
|
||||||
|
unar -o . "$full_path"
|
||||||
|
else
|
||||||
|
echo "extract: cannot extract RAR files: install unrar or unar" >&2
|
||||||
|
success=1
|
||||||
|
fi ;;
|
||||||
(*.rpm)
|
(*.rpm)
|
||||||
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
||||||
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user