Print message in fish_add_path -v when a path doesnt exist (#8884)

* Print message in set_fish_path -v when a path doesnt exist

* Update changelog

* Remove "; or continue"

* use printf instead of echo, avoid localizing the path
This commit is contained in:
Andrew Cassidy 2022-04-18 00:58:05 -07:00 committed by GitHub
parent e3c4cde042
commit d22f22c3b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -54,6 +54,7 @@ Interactive improvements
- ``ulimit`` learned a number of new options for the resource limits available on Linux, FreeBSD and NetBSD, and returns a specific warning if the limit specified is not available on the active operating system (:issue:`8823`).
- The ``vared`` command can now successfully edit variables named "tmp" or "prompt" (:issue:`8836`).
- ``time`` now emits an error if used after the first command in a pipeline (:issue:`8841`).
- ``fish_add_path`` now prints a message for skipped non-existent paths when using the ``-v`` flag.
New or improved bindings
^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -62480,6 +62480,10 @@ msgstr ""
msgid "Edit variable value"
msgstr "Edit variable value"
#: /tmp/fish/implicit/share/functions/fish_add_path.fish:1
msgid "Skipping non-existent path: %s\n"
msgstr "Skipping non-existent path: %s\n"
#~ msgid "%ls: No function name given\n"
#~ msgstr "%ls: No function name given\n"

View File

@ -47,7 +47,14 @@ function fish_add_path --description "Add paths to the PATH"
set -l p (builtin realpath -s -- $path 2>/dev/null)
# Ignore non-existing paths
test -d "$p"; or continue
if not test -d "$p"
# path does not exist
if set -q _flag_verbose;
# print a message in verbose mode
printf (_ "Skipping non-existent path: %s\n") "$p"
end
continue
end
if set -l ind (contains -i -- $p $$var)
# In move-mode, we remove it from its current position and add it back.