diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:29:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 10:29:49 +0000 |
commit | 1fd7da94235a7ee9cc21d25d39e6c03421ef5ab6 (patch) | |
tree | b4cc647f3e5833b224c5fd593023397a80cca78f /bash_completion.d/update-initramfs | |
parent | Initial commit. (diff) | |
download | initramfs-tools-1fd7da94235a7ee9cc21d25d39e6c03421ef5ab6.tar.xz initramfs-tools-1fd7da94235a7ee9cc21d25d39e6c03421ef5ab6.zip |
Adding upstream version 0.140.upstream/0.140upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bash_completion.d/update-initramfs')
-rw-r--r-- | bash_completion.d/update-initramfs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bash_completion.d/update-initramfs b/bash_completion.d/update-initramfs new file mode 100644 index 0000000..bf822cd --- /dev/null +++ b/bash_completion.d/update-initramfs @@ -0,0 +1,23 @@ +# update-initramfs(8) completion + +_update_initramfs() +{ + local cur prev valid_options + + _get_comp_words_by_ref cur prev + + # The only option that takes an argument is -k + if [[ "$prev" == '-k' ]]; then + # Complete with kernel versions + _kernel_versions + COMPREPLY=( $( compgen -W '${COMPREPLY[@]} all' -- "$cur" ) ) + return; + fi + + # Complete with available options (obtained from -h) + valid_options=$( update-initramfs -h 2>&1 | \ + sed -e '/^ -/!d;s/^ \(-\w\+\).*/\1/' ) + COMPREPLY=( $( compgen -W "$valid_options" -- $cur ) ) +} + +complete -F _update_initramfs update-initramfs |