rally-openstack/etc/rally.bash_completion
Oleksandr Savatieiev d3d799e024 [Reports] Significant improvements in verification report
* ability to show several verifications results (this
   deprecates command `rally verify compare')
 * command `rally verify compare' is removed - new report
   compares results in better way
 * new, unified, AngularJS/Jinja2-based template
 * new verifications results processing
 * new module rally.ui.report which cares about
   report generation (this is a place where code from
   rally.task.processing.plot should be also moved)

Examples:

  rally verify results\
    --uuid <uuid> --html > single_verification_result.html

  rally verify results\
    --uuid <uuid1> <uuid2> <uuid3> --html > compare_3.html

Co-Authored-By: Oleksandr Savatieiev <osavatieiev@mirantis.com>
Co-Authored-By: Alexander Maretskiy <amaretskiy@mirantis.com>
Change-Id: I942e0d9bf2094f3254dbeccbaa76dbbc3a3ca40e
2016-10-18 11:47:04 +03:00

94 lines
3.7 KiB
Bash

#!/bin/bash
# Standalone _filedir() alternative.
# This exempts from dependence of bash completion routines
function _rally_filedir()
{
test "${1}" \
&& COMPREPLY=( \
$(compgen -f -- "${cur}" | grep -E "${1}") \
$(compgen -o plusdirs -- "${cur}") ) \
|| COMPREPLY=( \
$(compgen -o plusdirs -f -- "${cur}") \
$(compgen -d -- "${cur}") )
}
_rally()
{
declare -A SUBCOMMANDS
declare -A OPTS
OPTS["deployment_check"]="--deployment"
OPTS["deployment_config"]="--deployment"
OPTS["deployment_create"]="--name --fromenv --filename --no-use"
OPTS["deployment_destroy"]="--deployment"
OPTS["deployment_list"]=""
OPTS["deployment_recreate"]="--deployment"
OPTS["deployment_show"]="--deployment"
OPTS["deployment_use"]="--deployment"
OPTS["plugin_list"]="--name --namespace"
OPTS["plugin_show"]="--name --namespace"
OPTS["show_flavors"]="--deployment"
OPTS["show_images"]="--deployment"
OPTS["show_keypairs"]="--deployment"
OPTS["show_networks"]="--deployment"
OPTS["show_secgroups"]="--deployment"
OPTS["task_abort"]="--uuid --soft"
OPTS["task_delete"]="--force --uuid"
OPTS["task_detailed"]="--uuid --iterations-data"
OPTS["task_export"]="--uuid --connection"
OPTS["task_list"]="--deployment --all-deployments --status --uuids-only"
OPTS["task_report"]="--tasks --out --open --html --html-static --junit"
OPTS["task_results"]="--uuid"
OPTS["task_sla_check"]="--uuid --json"
OPTS["task_start"]="--deployment --task --task-args --task-args-file --tag --no-use --abort-on-sla-failure"
OPTS["task_status"]="--uuid"
OPTS["task_trends"]="--out --open --tasks"
OPTS["task_use"]="--uuid"
OPTS["task_validate"]="--deployment --task --task-args --task-args-file"
OPTS["verify_compare"]=""
OPTS["verify_detailed"]="--uuid --sort-by"
OPTS["verify_discover"]="--deployment --pattern --system-wide"
OPTS["verify_genconfig"]="--deployment --tempest-config --add-options --override"
OPTS["verify_import"]="--deployment --set --file --no-use"
OPTS["verify_install"]="--deployment --source --version --system-wide"
OPTS["verify_installplugin"]="--deployment --source --version --system-wide"
OPTS["verify_list"]=""
OPTS["verify_listplugins"]="--deployment --system-wide"
OPTS["verify_reinstall"]="--deployment --source --version --system-wide"
OPTS["verify_results"]="--uuid --html --json --csv --output-file"
OPTS["verify_show"]="--uuid --sort-by --detailed"
OPTS["verify_showconfig"]="--deployment"
OPTS["verify_start"]="--deployment --set --regex --load-list --skip-list --tempest-config --xfail-list --no-use --system-wide --concurrency --failing"
OPTS["verify_uninstall"]="--deployment"
OPTS["verify_uninstallplugin"]="--deployment --repo-name --system-wide"
OPTS["verify_use"]="--uuid"
for OPT in ${!OPTS[*]} ; do
CMD=${OPT%%_*}
CMDSUB=${OPT#*_}
SUBCOMMANDS[${CMD}]+="${CMDSUB} "
done
COMMANDS="${!SUBCOMMANDS[*]}"
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ $cur =~ ^(\.|\~|\/) ]] || [[ $prev =~ ^--out(|put-file)$ ]] ; then
_rally_filedir
elif [[ $prev =~ ^--(task|filename)$ ]] ; then
_rally_filedir "\.json|\.yaml|\.yml"
elif [ $COMP_CWORD == "1" ] ; then
COMPREPLY=($(compgen -W "$COMMANDS" -- ${cur}))
elif [ $COMP_CWORD == "2" ] ; then
COMPREPLY=($(compgen -W "${SUBCOMMANDS[${prev}]}" -- ${cur}))
else
COMMAND="${COMP_WORDS[1]}_${COMP_WORDS[2]}"
COMPREPLY=($(compgen -W "${OPTS[$COMMAND]}" -- ${cur}))
fi
return 0
}
complete -o filenames -F _rally rally