From 974aa160f3da640a41b67fb432328ff98db22fac Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 5 Jun 2026 21:01:05 +0800 Subject: [PATCH] fish_update_completions: pass explicit directory argument Gets rid of another use of XDG_CACHE_HOME; this gets us closer to a single source of truth. Not super important right now, but will be helpful if we allow users to override XDG_CACHE_HOME in future. I guess we could also remove it from create_manpage_completions.py, that's unnecessary breakage but probably fine since this is not public-facing. --- share/functions/fish_update_completions.fish | 4 ++-- share/tools/create_manpage_completions.py | 1 + tests/checks/fish_update_completions.fish | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/share/functions/fish_update_completions.fish b/share/functions/fish_update_completions.fish index 16c1f4587..544083fc6 100644 --- a/share/functions/fish_update_completions.fish +++ b/share/functions/fish_update_completions.fish @@ -16,9 +16,9 @@ function fish_update_completions --description "Update man-page based completion - \ # Use the manpath --manpath \ + --directory=$__fish_cache_dir/generated_completions \ # Clean up old completions - --cleanup-in $__fish_user_data_dir/generated_completions \ - --cleanup-in $__fish_cache_dir/generated_completions + --cleanup-in $__fish_user_data_dir/generated_completions status get-file tools/create_manpage_completions.py | if $detach diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py index cc990fbb6..03903dfdd 100755 --- a/share/tools/create_manpage_completions.py +++ b/share/tools/create_manpage_completions.py @@ -2231,6 +2231,7 @@ if __name__ == "__main__": args.directory = os.path.expanduser( xdg_cache_home + "/fish/generated_completions/" ) + if not args.stdout: try: os.makedirs(args.directory) except OSError as e: diff --git a/tests/checks/fish_update_completions.fish b/tests/checks/fish_update_completions.fish index 7d2a23d94..af878c1ac 100644 --- a/tests/checks/fish_update_completions.fish +++ b/tests/checks/fish_update_completions.fish @@ -24,7 +24,7 @@ end each output line with NUL, not newline ' MANPATH=$PWD/man fish_update_completions -# CHECK: Parsing man pages and writing completions to {{.*}}/generated_completions/ +# CHECK: Parsing man pages and writing completions to {{.*}}/generated_completions # CHECK: {{.*}} 1 / 1 : dirname.1{{.*}} cd $__fish_cache_dir