1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2025-12-12 15:34:50 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
ha7v
07b3f5b8c5
Merge d6552d8887 into 92aed2e936 2025-12-10 14:09:15 +04: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
ha7v
d6552d8887
Enhance clipboard functionality for various environments
Added clipboard functions for SSH and terminal emulators.
2025-11-14 17:56:59 +08:00
2 changed files with 26 additions and 1 deletions

View File

@ -54,6 +54,23 @@ function detect-clipboard() {
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
function clipcopy() { cat "${1:-/dev/stdin}" | pbcopy; }
function clippaste() { pbpaste; }
elif [[ -n "$SSH_CONNECTION" || -n "$SSH_TTY" ]] && \
[[ "$TERM" =~ '^(screen|xterm|iterm|kitty|wezterm|alacritty)' || -n "$TERMINAL_EMULATOR" ]] && \
(( ${+commands[base64]} )); then
function clipcopy() {
emulate -L zsh
local content
if [[ -n "$1" && -f "$1" ]]; then
content=$(<"$1")
else
content=$(</dev/stdin)
fi
printf "\e]52;c;%s\a" "$(echo -n "$content" | base64 | tr -d '\n')"
}
function clippaste() {
print "clippaste: reading clipboard via OSC 52 is not supported for security reasons." >&2
return 1
}
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
function clippaste() { cat /dev/clipboard; }

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" ;;