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

Compare commits

...

5 Commits

Author SHA1 Message Date
Sanjar Afaq
894d97c0af
Merge dff57f2dd3 into 92aed2e936 2025-12-10 14:09:14 +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
google-labs-jules[bot]
dff57f2dd3 fix(jump): correct error handling in getmark function
This commit fixes a bug in the `getmark` function where it would not correctly handle non-existent marks. The previous implementation would swallow the error from `realpath`, causing the `||` condition to not be triggered.

This has been corrected by removing the command substitution and directly checking the exit code of `realpath`. The error message is now correctly printed to stderr, and the function returns a non-zero exit code on failure.
2025-10-18 17:20:21 +00:00
google-labs-jules[bot]
0d44fd642a docs(jump): update readme with getmark command
This commit updates the `README.md` file for the `jump` plugin to include documentation for the new `getmark` command.
2025-10-18 16:05:37 +00:00
google-labs-jules[bot]
2757306ef1 refactor(jump): improve robustness of getmark function
This commit refactors the `getmark` function in the `jump` plugin to improve its robustness and consistency with the rest of the file.

The `LANG=` prefix is added to ensure that the output of the `realpath` command is in a consistent, predictable format. The `command` prefix is used to bypass any potential aliases for `realpath` and `echo`, ensuring that the script executes the intended commands.
2025-10-18 16:00:58 +00:00
3 changed files with 15 additions and 1 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" ;;

View File

@ -17,6 +17,7 @@ plugins=(... jump)
| `mark [mark-name]` | Create a mark with the given name or with the name of the current directory if none is provided |
| `unmark <mark-name>` | Remove the given mark |
| `marks` | List the existing marks and the directories they point to |
| `getmark <mark-name>`| Get the full path of a mark |
## Key bindings

View File

@ -45,11 +45,16 @@ marks() {
done
}
function getmark {
LANG= command realpath "$MARKPATH/$1" 2>/dev/null || { command echo "No such mark: $1" >&2; return 1; }
}
_completemarks() {
reply=("${MARKPATH}"/{,.}*(@N:t))
}
compctl -K _completemarks jump
compctl -K _completemarks unmark
compctl -K _completemarks getmark
_mark_expansion() {
setopt localoptions extendedglob