-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shell completion for mangohud & mangohudctl #710
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# bash completion for mangohud(1) -*- shell-script -*- | ||
|
||
_mangohud() { | ||
local cur prev words cword split | ||
_init_completion -s || return | ||
|
||
for (( i = 1; i <= cword; i++ )); do | ||
if [[ ${words[i]} != -* ]]; then | ||
local root_command=${words[i]} | ||
_command_offset "$i" | ||
return | ||
fi | ||
done | ||
|
||
$split && return | ||
|
||
if [[ $cur == -* ]]; then | ||
COMPREPLY=(--dlsym) | ||
return | ||
fi | ||
} && | ||
complete -F _mangohud mangohud |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# bash completion for mangohudctl(1) -*- shell-script -*- | ||
|
||
_mangohudctl() { | ||
local cur prev words cword split | ||
_init_completion -s || return | ||
|
||
$split && return | ||
|
||
if [[ $cword == 1 ]]; then | ||
COMPREPLY=( $(compgen -W "set toggle" -- $cur) ) | ||
elif [[ $cword == 2 ]]; then | ||
COMPREPLY=( $(compgen -W "$(mangohudctl 2>&1 | sed -n '/^Usage/d;/Attributes:/d;/Accepted/q;s/\s\+//;s/\s\+.*$//;p')" -- $cur) ) | ||
elif [[ $cword == 3 && ${words[1]} == set ]]; then | ||
COMPREPLY=( $(compgen -W "true false" -- $cur) ) | ||
fi | ||
} && | ||
complete -F _mangohudctl mangohudctl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
bashcompletiondir = get_option('bashcompletiondir') | ||
if bashcompletiondir == '' | ||
bash_completion = dependency('bash-completion', required: false) | ||
bashcompletion_defaultdir = get_option('prefix') / get_option('datadir') / 'bash-completion/completions' | ||
if bash_completion.found() | ||
bashcompletiondir = bash_completion.get_variable(pkgconfig: 'completionsdir', default_value: bashcompletion_defaultdir) | ||
else | ||
bashcompletiondir = bash_completion_defaultdir | ||
endif | ||
endif | ||
|
||
if bashcompletiondir != 'no' | ||
install_data('mangohud', install_dir: bashcompletiondir) | ||
install_data('mangohudctl', install_dir: bashcompletiondir) | ||
endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ option('glibcxx_asserts', type : 'boolean', value : false) | |
option('use_system_vulkan', type : 'feature', value : 'disabled', description: 'Use system vulkan headers instead of the provided ones') | ||
option('use_system_spdlog', type : 'feature', value : 'disabled', description: 'Use system spdlog library') | ||
option('vulkan_datadir', type : 'string', value : '', description: 'Path to the system vulkan headers data directory if different from MangoHud\'s datadir') | ||
option('bashcompletiondir', type: 'string', description: 'Directory for bash completion script ["no" disables]') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO the extra toggle is an overkill. The completion files are not even 50 lines in total, so I'd just install them always. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This option specifies where to put the bash completions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The existing logic will work with virtually any linux distro, even ones like Yocto. So in practical terms, the toggle is used for disabling the lot. The fragment looked oddly familiar - thanks for confirming it's systemd origin. |
||
option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.') | ||
option('ld_libdir_prefix', type : 'boolean', value : false, description: 'Set ld libdir to "$prefix/lib/mangohud/\$LIB"') | ||
option('ld_libdir_abs', type : 'boolean', value : false, description: 'Use absolute path in LD_PRELOAD') | ||
|
@@ -16,4 +17,4 @@ option('with_dlsym', type : 'feature', value : 'disabled') | |
option('loglevel', type: 'combo', choices : ['trace', 'debug', 'info', 'warn', 'err', 'critical', 'off'], value : 'info', description: 'Max log level in non-debug build') | ||
option('mangoapp', type: 'boolean', value : 'false') | ||
option('mangohudctl', type: 'boolean', value : 'false') | ||
option('mangoapp_layer', type: 'boolean', value : 'false') | ||
option('mangoapp_layer', type: 'boolean', value : 'false') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add
install_tag: 'scripts'
for theseinstall_data
s?Or some better tag though I already tagged
mangohud
with it :P