From 000dd5d699a2c3ada91526bcfa925595adace77f Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 26 Feb 2024 21:26:26 -0600 Subject: [PATCH] trivial: move completions to their own directory --- src/completions/meson.build | 31 +++++++++++++++++++++++++++++++ src/meson.build | 32 +------------------------------- 2 files changed, 32 insertions(+), 31 deletions(-) create mode 100644 src/completions/meson.build diff --git a/src/completions/meson.build b/src/completions/meson.build new file mode 100644 index 0000000..63d758c --- /dev/null +++ b/src/completions/meson.build @@ -0,0 +1,31 @@ +generate_completion = [python3, powerprofilesctl, '--print-completion'] +if bashcomp.found() + completions_dir = bashcomp.get_variable(pkgconfig: 'completionsdir', + pkgconfig_define: bashcomp.version().version_compare('>= 2.10') ? + ['datadir', get_option('datadir')] : ['prefix', prefix], + ) + + custom_target('bash-completion', + output: 'powerprofilesctl', + command: [ + generate_completion, + 'bash', + ], + capture: true, + install: true, + install_dir: completions_dir, + ) +endif + +if zshcomp + custom_target('zsh-completion', + output: '_powerprofilesctl', + command: [ + generate_completion, + 'zsh', + ], + capture: true, + install: true, + install_dir: get_option('zshcomp'), + ) +endif diff --git a/src/meson.build b/src/meson.build index a495185..ccb8c0f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -147,34 +147,4 @@ if argparse_manpage.found() )) endif -generate_completion = [python3, powerprofilesctl, '--print-completion'] -if bashcomp.found() - completions_dir = bashcomp.get_variable(pkgconfig: 'completionsdir', - pkgconfig_define: bashcomp.version().version_compare('>= 2.10') ? - ['datadir', get_option('datadir')] : ['prefix', prefix], - ) - - custom_target('bash-completion', - output: 'powerprofilesctl', - command: [ - generate_completion, - 'bash', - ], - capture: true, - install: true, - install_dir: completions_dir, - ) -endif - -if zshcomp - custom_target('zsh-completion', - output: '_powerprofilesctl', - command: [ - generate_completion, - 'zsh', - ], - capture: true, - install: true, - install_dir: get_option('zshcomp'), - ) -endif +subdir('completions') \ No newline at end of file