From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/bash_completion/CMakeLists.txt | 15 +++++++ src/bash_completion/ceph | 50 +++++++++++++++++++++++ src/bash_completion/rados | 40 ++++++++++++++++++ src/bash_completion/radosgw-admin | 57 ++++++++++++++++++++++++++ src/bash_completion/rbd | 83 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 245 insertions(+) create mode 100644 src/bash_completion/CMakeLists.txt create mode 100644 src/bash_completion/ceph create mode 100644 src/bash_completion/rados create mode 100644 src/bash_completion/radosgw-admin create mode 100644 src/bash_completion/rbd (limited to 'src/bash_completion') diff --git a/src/bash_completion/CMakeLists.txt b/src/bash_completion/CMakeLists.txt new file mode 100644 index 00000000..8d834774 --- /dev/null +++ b/src/bash_completion/CMakeLists.txt @@ -0,0 +1,15 @@ +set(completions + ceph + rados) + +if(WITH_RBD) + list(APPEND completions rbd) +endif() + +if(WITH_RADOSGW) + list(APPEND completions radosgw-admin) +endif() + +install(FILES ${completions} + DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/bash_completion.d) + diff --git a/src/bash_completion/ceph b/src/bash_completion/ceph new file mode 100644 index 00000000..d28c8a4f --- /dev/null +++ b/src/bash_completion/ceph @@ -0,0 +1,50 @@ +# +# Ceph - scalable distributed file system +# +# This is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software +# Foundation. +# + +_ceph() +{ + local options_noarg="-h --help -s --status -w --watch --watch-debug --watch-info --watch-sec --watch-warn --watch-error --version -v --verbose --concise" + local options_arg="-c --conf -i --in-file -o --out-file --id --user -n --name --cluster --admin-daemon --admin-socket -f --format --connect-timeout" + local cnt=${#COMP_WORDS[@]} + local cur=${COMP_WORDS[COMP_CWORD]} + local prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ " -c --conf -i --in-file -o --out-file " =~ " ${prev} " ]] + then + #default autocomplete for options (file autocomplete) + compopt -o default + COMPREPLY=() + return 0 + fi + if [[ "${cur:0:1}" == "-" ]] ; + then + COMPREPLY=( $(compgen -W "${options_noarg} ${options_arg}" -- $cur) ) + return 0 + fi + declare -a hint_args + for (( i=1 ; i/dev/null) ) +} +complete -F _ceph ceph diff --git a/src/bash_completion/rados b/src/bash_completion/rados new file mode 100644 index 00000000..63501875 --- /dev/null +++ b/src/bash_completion/rados @@ -0,0 +1,40 @@ +# +# Ceph - scalable distributed file system +# +# Copyright (C) 2011 Wido den Hollander +# +# This is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software +# Foundation. See file COPYING. +# + +_rados() +{ + local cur prev + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + if [[ ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "-c --conf -m -d -f -p --pool -b --snap -i -o --create" -- ${cur}) ) + return 0 + fi + + case "${prev}" in + --conf | -c | -o | -i) + COMPREPLY=( $(compgen -f ${cur}) ) + return 0 + ;; + -m) + COMPREPLY=( $(compgen -A hostname ${cur}) ) + return 0 + ;; + rados) + COMPREPLY=( $(compgen -W "lspools df ls chown get put create rm listxattr getxattr setxattr rmxattr stat stat2 mapext lssnap mksnap rmsnap rollback bench" -- ${cur}) ) + return 0 + ;; + esac +} +complete -F _rados rados diff --git a/src/bash_completion/radosgw-admin b/src/bash_completion/radosgw-admin new file mode 100644 index 00000000..023a83f8 --- /dev/null +++ b/src/bash_completion/radosgw-admin @@ -0,0 +1,57 @@ +# +# Ceph - scalable distributed file system +# +# Copyright (C) 2011 Wido den Hollander +# +# This is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software +# Foundation. See file COPYING. +# + +_radosgw_admin() +{ + local cur prev + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + if [[ ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "--uid --subuser --access-key --os-user --email --auth_uid --secret --os-secret --gen-access-key --gen-secret \ + --access --display-name --bucket --object --date --conf --name --id --version -s -w" -- ${cur}) ) + return 0 + fi + + case "${prev}" in + --conf | -c) + COMPREPLY=( $(compgen -f ${cur}) ) + return 0 + ;; + -m) + COMPREPLY=( $(compgen -A hostname ${cur}) ) + return 0 + ;; + user) + COMPREPLY=( $(compgen -W "create modify info rm" -- ${cur}) ) + return 0 + ;; + subuser) + COMPREPLY=( $(compgen -W "create modify rm" -- ${cur}) ) + return 0 + ;; + key) + COMPREPLY=( $(compgen -W "create rm" -- ${cur}) ) + return 0 + ;; + buckets) + COMPREPLY=( $(compgen -W "list unlink" -- ${cur}) ) + return 0 + ;; + *) + COMPREPLY=( $(compgen -W "user subuser key buckets policy log" -- ${cur}) ) + return 0 + ;; + esac +} +complete -F _radosgw_admin radosgw-admin diff --git a/src/bash_completion/rbd b/src/bash_completion/rbd new file mode 100644 index 00000000..bef1670e --- /dev/null +++ b/src/bash_completion/rbd @@ -0,0 +1,83 @@ +# +# Ceph - scalable distributed file system +# +# Copyright (C) 2011 Wido den Hollander +# +# This is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software +# Foundation. See file COPYING. +# +_rbd_commands="" # lazy init +_rbd_global_options="" # lazy init + +_rbd() +{ + if [ "x${_rbd_commands}" == "x" ]; then + local rbc="$(rbd bash-completion 2>/dev/null)" + _rbd_commands="$(echo ${rbc} | sed -e 's/|-[^|]*//g' -e 's/||*/|/g')" + _rbd_global_options="$(echo ${rbc} | sed -e 's/|[^-][^\|]*//g' -e 's/||*/|/g')" + fi + + COMPREPLY=() + + local arg_count=${#COMP_WORDS[@]} + local args=() + local help_request="false" + for (( i=1; i