2024-02-27 04:26:26 +01:00
|
|
|
generate_completion = [python3, powerprofilesctl, '--print-completion']
|
2024-04-02 00:31:39 +02:00
|
|
|
|
|
|
|
completions_common = {
|
|
|
|
'env': {'PPD_COMPLETIONS_GENERATION': '1'},
|
|
|
|
'capture': true,
|
|
|
|
'install': true,
|
|
|
|
}
|
|
|
|
|
2024-02-27 04:26:26 +01:00
|
|
|
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',
|
|
|
|
],
|
|
|
|
install_dir: completions_dir,
|
2024-04-02 00:31:39 +02:00
|
|
|
kwargs: completions_common,
|
2024-02-27 04:26:26 +01:00
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if zshcomp
|
|
|
|
custom_target('zsh-completion',
|
|
|
|
output: '_powerprofilesctl',
|
|
|
|
command: [
|
|
|
|
generate_completion,
|
|
|
|
'zsh',
|
|
|
|
],
|
2024-04-04 16:56:15 +02:00
|
|
|
install_dir: get_option('zshcomp') != '' ? get_option('datadir') / 'zsh' / 'site-functions' : get_option('zshcomp'),
|
2024-04-02 00:31:39 +02:00
|
|
|
kwargs: completions_common,
|
2024-02-27 04:26:26 +01:00
|
|
|
)
|
|
|
|
endif
|