diff --git a/doc_src/cmds/fish_add_path.rst b/doc_src/cmds/fish_add_path.rst index cbc0b5a03..c43066f8e 100644 --- a/doc_src/cmds/fish_add_path.rst +++ b/doc_src/cmds/fish_add_path.rst @@ -52,7 +52,8 @@ Options Move already-included directories to the place they would be added - by default they would be left in place and not added again. **-v** or **--verbose** - Print the :doc:`set ` command used. + Print the :doc:`set ` command used, and some more warnings, like when a path is skipped because it doesn't exist or is not a directory. + Verbose mode is automatically enabled when fish_add_path is used interactively and the output goes to the terminal. **-n** or **--dry-run** Print the ``set`` command that would be used without executing it. diff --git a/share/functions/fish_add_path.fish b/share/functions/fish_add_path.fish index 4a119b548..6e2316dd8 100644 --- a/share/functions/fish_add_path.fish +++ b/share/functions/fish_add_path.fish @@ -36,6 +36,11 @@ function fish_add_path --description "Add paths to the PATH" set -l mode $_flag_prepend $_flag_append set -q mode[1]; or set mode -p + # Enable verbose mode if we're interactively used + status current-command | string match -rq '^fish_add_path$' + and isatty stdout + and set -l _flag_verbose yes + # To keep the order of our arguments, go through and save the ones we want to keep. set -l newpaths set -l indexes