Skip to content

Commit 803d628

Browse files
committed
Completion: Hard-code directories where to install completion scripts
Requiring having a shell installed at build-time to get the appropriate location won't cover the cases like when a system has such a location set to a non-standard path. The use of fallbacks together with hardcoded paths also increases the complexity of this particular feature. All 3 major shells (Bash, Zsh, Fish) have documented default directories where they look for completion scripts and we can make use of that. Additionaly, hard-coding of these paths seems to be the standard among projects. Fallout from containers#840 containers#1055
1 parent 33af1f1 commit 803d628

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

completion/meson.build

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
if bash_completion.found()
2-
bash_comp_dir = bash_completion.get_pkgconfig_variable('completionsdir')
3-
else
4-
bash_comp_dir = get_option('datadir') / 'bash-completion' / 'completions'
5-
message('bash-completion not found: using', get_option('prefix') / bash_comp_dir, 'as a falback install directory')
6-
endif
7-
8-
if fish.found()
9-
fish_comp_dir = fish.get_pkgconfig_variable('completionsdir')
10-
else
11-
fish_comp_dir = get_option('datadir') / 'fish' / 'completions'
12-
message('fish not found: using', get_option('prefix') / fish_comp_dir, 'as a fallback install directory')
13-
endif
1+
bash_comp_dir = get_option('datadir') / 'bash-completion' / 'completions'
2+
zsh_comp_dir = get_option('datadir') / 'zsh' / 'site-functions'
3+
fish_comp_dir = get_option('datadir') / 'fish' / 'vendor_completions.d'
144

155
completion_bash = custom_target('bash-completion',
166
capture: true,
@@ -23,7 +13,7 @@ completion_zsh = custom_target('zsh-completion',
2313
capture: true,
2414
command: [toolbox, 'completion', 'zsh'],
2515
install: true,
26-
install_dir: get_option('datadir') / 'zsh' / 'site-functions',
16+
install_dir: zsh_comp_dir,
2717
output: '_toolbox')
2818

2919
completion_fish = custom_target('fish-completion',

meson.build

-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ go_md2man = find_program('go-md2man')
1818
shellcheck = find_program('shellcheck', required: false)
1919
skopeo = find_program('skopeo', required: false)
2020

21-
bash_completion = dependency('bash-completion', required: false)
22-
fish = dependency('fish', required: false)
23-
2421
migration_path_for_coreos_toolbox = get_option('migration_path_for_coreos_toolbox')
2522
profiledir = get_option('profile_dir')
2623

0 commit comments

Comments
 (0)