]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
meson: factor common strings when handling shell completions
authorEmil Velikov <emil.l.velikov@gmail.com>
Thu, 24 Oct 2024 18:49:18 +0000 (19:49 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 24 Oct 2024 23:10:12 +0000 (18:10 -0500)
Remove some of the repetition, by moving the common roots as needed.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/209
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
meson.build

index 1b862c969f031c31908502c992ff9df9f1d20ea9..ac4ca41f90d3d9a4a3241797461e05be1a6d9d68 100644 (file)
@@ -225,16 +225,16 @@ foreach tuple : _customdirs
 endforeach
 
 _completiondirs = [
-  ['bashcompletiondir', 'bash-completion', 'bash-completion/completions', 'shell-completion/bash/@0@'],
-  ['fishcompletiondir', 'fish',            'fish/vendor_functions.d',     'shell-completion/fish/@0@.fish'],
-  ['zshcompletiondir',  '',                'zsh/site-functions',          'shell-completion/zsh/_@0@'],
+  ['bash', 'bash-completion', 'bash-completion' / 'completions', '@0@'],
+  ['fish', 'fish',            'fish' / 'vendor_functions.d',     '@0@.fish'],
+  ['zsh',  '',                'zsh' / 'site-functions',          '_@0@'],
 ]
 
 foreach tuple : _completiondirs
-  dir_option = tuple[0]
+  dir_option = tuple[0] + 'completiondir'
   pkg_dep = tuple[1]
   def_path = tuple[2]
-  ins_path = tuple[3]
+  ins_name = tuple[3]
 
   completiondir = get_variable(dir_option)
   if completiondir == ''
@@ -264,7 +264,7 @@ foreach tuple : _completiondirs
   if completiondir != 'no'
     foreach comp : _completions
       install_data(
-        files(ins_path.format(comp)),
+        files('shell-completion' / tuple[0] / ins_name.format(comp)),
         install_dir : completiondir,
       )
     endforeach