1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-01-07 21:18:01 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Romeo Morcia
63306ed383
Merge 28145c2239 into 92aed2e936 2025-12-10 00:02:53 +01:00
Tanzim Hossain Romel
92aed2e936
feat(extract): add unar as fallback for RAR extraction (#13472)
Add unar as a fallback when unrar is not available for extracting
RAR files. This addresses the issue where unrar has been removed
from Homebrew due to licensing issues.

The extraction now:
- Prefers unrar if available (backward compatible)
- Falls back to unar if unrar is not found
- Shows helpful error message if neither tool is installed
2025-12-09 20:14:31 +01:00
Romeo Morcia
28145c2239
Added the possibility of showing all preferred themes in .zsh_favlist file 2023-03-26 14:14:42 +02:00
2 changed files with 32 additions and 2 deletions

View File

@ -77,7 +77,15 @@ EOF
(*.lzma) unlzma "$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" ;;
(*.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)
rpm2cpio "$full_path" | cpio --quiet -id ;;
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;

24
tools/theme_chooser.sh Executable file → Normal file
View File

@ -29,6 +29,25 @@ function theme_preview() {
print -P "$PROMPT $RPROMPT"
}
function fav_theme_preview() {
if [[ -s $FAVLIST ]]; then
for THEME_NAME in $(cat $FAVLIST); do
THEME="$THEME_NAME.zsh-theme"
print "$fg[blue]${(l.((${COLUMNS}-${#THEME_NAME}-5))..─.)}$reset_color $THEME_NAME $fg[blue]───$reset_color"
source "$THEMES_DIR/$THEME"
cols=$(tput cols)
(exit 1)
print -P "$PROMPT $RPROMPT"
done
else
if ! noyes "No ($FAVLIST) in the system. Do you want to preview all the available themes?"; then
theme_chooser 0
else
echo "Okay, exiting."
fi
fi
}
function banner() {
echo
echo "╺━┓┏━┓╻ ╻ ╺┳╸╻ ╻┏━╸┏┳┓┏━╸ ┏━╸╻ ╻┏━┓┏━┓┏━┓┏━╸┏━┓"
@ -43,6 +62,7 @@ function usage() {
echo "Options"
echo " -l List available themes"
echo " -s Show all themes"
echo " -f Show favourite themes"
echo " -h Get this help message"
exit 1
}
@ -77,11 +97,12 @@ function theme_chooser() {
done
}
while getopts ":lhs" Option
while getopts ":lhsf" Option
do
case $Option in
l ) list_themes ;;
s ) theme_chooser 0 ;;
f ) fav_theme_preview ;;
h ) usage ;;
* ) usage ;; # Default.
esac
@ -96,3 +117,4 @@ if [[ -z $Option ]]; then
theme_preview $1".zsh-theme"
fi
fi