1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-01-16 23:37:55 +08:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Sanjar Afaq
38791d0d2e
Merge dff57f2dd3 into 72acd2ca90 2025-12-08 08:34:27 -08: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
2 changed files with 6 additions and 0 deletions

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