From 281a854b472a6e265be4e207c5ab26a8767554cd Mon Sep 17 00:00:00 2001 From: Frank Viernau Date: Mon, 4 Dec 2023 09:16:33 +0100 Subject: [PATCH] fix(integrations): Re-generate shell completions Re-align the completion scripts after dropping an option from the scanner command. Signed-off-by: Frank Viernau --- integrations/completions/ort-completion.bash | 1397 ------------------ integrations/completions/ort-completion.fish | 44 +- integrations/completions/ort-completion.zsh | 217 ++- 3 files changed, 228 insertions(+), 1430 deletions(-) diff --git a/integrations/completions/ort-completion.bash b/integrations/completions/ort-completion.bash index 87828a3034dc0..e69de29bb2d1d 100644 --- a/integrations/completions/ort-completion.bash +++ b/integrations/completions/ort-completion.bash @@ -1,1397 +0,0 @@ -#!/usr/bin/env bash -# Command completion for ort -# Generated by Clikt - -__skip_opt_eq() { - # this takes advantage of the fact that bash functions can write to local - # variables in their callers - (( i = i + 1 )) - if [[ "${COMP_WORDS[$i]}" == '=' ]]; then - (( i = i + 1 )) - fi -} - -_ort() { - local i=1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --config|-c) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--config' || in_param='' - continue - ;; - --error|--warn|--info|--debug) - __skip_opt_eq - in_param='' - continue - ;; - --stacktrace) - __skip_opt_eq - in_param='' - continue - ;; - -P) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='-P' || in_param='' - continue - ;; - --help-all) - __skip_opt_eq - in_param='' - continue - ;; - --generate-completion) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--generate-completion' || in_param='' - continue - ;; - --version|-v) - __skip_opt_eq - in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - advise) - _ort_advise $(( i + 1 )) - return - ;; - analyze) - _ort_analyze $(( i + 1 )) - return - ;; - config) - _ort_config $(( i + 1 )) - return - ;; - download) - _ort_download $(( i + 1 )) - return - ;; - evaluate) - _ort_evaluate $(( i + 1 )) - return - ;; - notify) - _ort_notify $(( i + 1 )) - return - ;; - report) - _ort_report $(( i + 1 )) - return - ;; - requirements) - _ort_requirements $(( i + 1 )) - return - ;; - scan) - _ort_scan $(( i + 1 )) - return - ;; - upload-curations) - _ort_upload_curations $(( i + 1 )) - return - ;; - upload-result-to-postgres) - _ort_upload_result_to_postgres $(( i + 1 )) - return - ;; - upload-result-to-sw360) - _ort_upload_result_to_sw360 $(( i + 1 )) - return - ;; - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--config -c --error --warn --info --debug --stacktrace -P --help-all --generate-completion --version -v -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --config) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --error) - ;; - --stacktrace) - ;; - -P) - ;; - --help-all) - ;; - --generate-completion) - ;; - --version) - ;; - --help) - ;; - *) - COMPREPLY=($(compgen -W 'advise analyze config download evaluate notify report requirements scan upload-curations upload-result-to-postgres upload-result-to-sw360' -- "${word}")) - ;; - esac -} - -_ort_advise() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --ort-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' - continue - ;; - --output-dir|-o) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-dir' || in_param='' - continue - ;; - --output-formats|-f) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-formats' || in_param='' - continue - ;; - --label|-l) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--label' || in_param='' - continue - ;; - --resolutions-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--resolutions-file' || in_param='' - continue - ;; - --advisors|-a) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--advisors' || in_param='' - continue - ;; - --skip-excluded) - __skip_opt_eq - in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --output-dir -o --output-formats -f --label -l --resolutions-file --advisors -a --skip-excluded -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --ort-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-formats) - COMPREPLY=($(compgen -W 'JSON XML YAML' -- "${word}")) - ;; - --label) - ;; - --resolutions-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --advisors) - ;; - --skip-excluded) - ;; - --help) - ;; - esac -} - -_ort_analyze() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --input-dir|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--input-dir' || in_param='' - continue - ;; - --output-dir|-o) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-dir' || in_param='' - continue - ;; - --output-formats|-f) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-formats' || in_param='' - continue - ;; - --repository-configuration-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--repository-configuration-file' || in_param='' - continue - ;; - --resolutions-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--resolutions-file' || in_param='' - continue - ;; - --label|-l) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--label' || in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--input-dir -i --output-dir -o --output-formats -f --repository-configuration-file --resolutions-file --label -l -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --input-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-formats) - COMPREPLY=($(compgen -W 'JSON XML YAML' -- "${word}")) - ;; - --repository-configuration-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --resolutions-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --label) - ;; - --help) - ;; - esac -} - -_ort_config() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --show-default) - __skip_opt_eq - in_param='' - continue - ;; - --show-active) - __skip_opt_eq - in_param='' - continue - ;; - --show-reference) - __skip_opt_eq - in_param='' - continue - ;; - --check-syntax) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--check-syntax' || in_param='' - continue - ;; - --hocon-to-yaml) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--hocon-to-yaml' || in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--show-default --show-active --show-reference --check-syntax --hocon-to-yaml -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --show-default) - ;; - --show-active) - ;; - --show-reference) - ;; - --check-syntax) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --hocon-to-yaml) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --help) - ;; - esac -} - -_ort_download() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --ort-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' - continue - ;; - --project-url) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--project-url' || in_param='' - continue - ;; - --project-name) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--project-name' || in_param='' - continue - ;; - --vcs-type) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--vcs-type' || in_param='' - continue - ;; - --vcs-revision) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--vcs-revision' || in_param='' - continue - ;; - --vcs-path) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--vcs-path' || in_param='' - continue - ;; - --license-classifications-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--license-classifications-file' || in_param='' - continue - ;; - --output-dir|-o) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-dir' || in_param='' - continue - ;; - --archive) - __skip_opt_eq - in_param='' - continue - ;; - --archive-all) - __skip_opt_eq - in_param='' - continue - ;; - --package-types) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--package-types' || in_param='' - continue - ;; - --package-ids) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--package-ids' || in_param='' - continue - ;; - --skip-excluded) - __skip_opt_eq - in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --project-url --project-name --vcs-type --vcs-revision --vcs-path --license-classifications-file --output-dir -o --archive --archive-all --package-types --package-ids --skip-excluded -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --ort-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --project-url) - ;; - --project-name) - ;; - --vcs-type) - ;; - --vcs-revision) - ;; - --vcs-path) - ;; - --license-classifications-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --archive) - ;; - --archive-all) - ;; - --package-types) - COMPREPLY=($(compgen -W 'PACKAGE PROJECT' -- "${word}")) - ;; - --package-ids) - ;; - --skip-excluded) - ;; - --help) - ;; - esac -} - -_ort_evaluate() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --ort-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' - continue - ;; - --output-dir|-o) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-dir' || in_param='' - continue - ;; - --output-formats|-f) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-formats' || in_param='' - continue - ;; - --rules-file|-r) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--rules-file' || in_param='' - continue - ;; - --rules-resource) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--rules-resource' || in_param='' - continue - ;; - --copyright-garbage-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--copyright-garbage-file' || in_param='' - continue - ;; - --license-classifications-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--license-classifications-file' || in_param='' - continue - ;; - --package-configurations-dir) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--package-configurations-dir' || in_param='' - continue - ;; - --package-curations-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--package-curations-file' || in_param='' - continue - ;; - --package-curations-dir) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--package-curations-dir' || in_param='' - continue - ;; - --repository-configuration-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--repository-configuration-file' || in_param='' - continue - ;; - --resolutions-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--resolutions-file' || in_param='' - continue - ;; - --label|-l) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--label' || in_param='' - continue - ;; - --check-syntax) - __skip_opt_eq - in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --output-dir -o --output-formats -f --rules-file -r --rules-resource --copyright-garbage-file --license-classifications-file --package-configurations-dir --package-curations-file --package-curations-dir --repository-configuration-file --resolutions-file --label -l --check-syntax -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --ort-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-formats) - COMPREPLY=($(compgen -W 'JSON XML YAML' -- "${word}")) - ;; - --rules-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --rules-resource) - ;; - --copyright-garbage-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --license-classifications-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --package-configurations-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --package-curations-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --package-curations-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --repository-configuration-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --resolutions-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --label) - ;; - --check-syntax) - ;; - --help) - ;; - esac -} - -_ort_notify() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --ort-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' - continue - ;; - --notifications-file|-n) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--notifications-file' || in_param='' - continue - ;; - --resolutions-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--resolutions-file' || in_param='' - continue - ;; - --label|-l) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--label' || in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --notifications-file -n --resolutions-file --label -l -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --ort-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --notifications-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --resolutions-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --label) - ;; - --help) - ;; - esac -} - -_ort_report() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --ort-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' - continue - ;; - --output-dir|-o) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-dir' || in_param='' - continue - ;; - --report-formats|-f) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--report-formats' || in_param='' - continue - ;; - --copyright-garbage-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--copyright-garbage-file' || in_param='' - continue - ;; - --custom-license-texts-dir) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--custom-license-texts-dir' || in_param='' - continue - ;; - --how-to-fix-text-provider-script) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--how-to-fix-text-provider-script' || in_param='' - continue - ;; - --license-classifications-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--license-classifications-file' || in_param='' - continue - ;; - --package-configurations-dir) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--package-configurations-dir' || in_param='' - continue - ;; - --refresh-resolutions) - __skip_opt_eq - in_param='' - continue - ;; - --repository-configuration-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--repository-configuration-file' || in_param='' - continue - ;; - --resolutions-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--resolutions-file' || in_param='' - continue - ;; - --report-option|-O) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--report-option' || in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --output-dir -o --report-formats -f --copyright-garbage-file --custom-license-texts-dir --how-to-fix-text-provider-script --license-classifications-file --package-configurations-dir --refresh-resolutions --repository-configuration-file --resolutions-file --report-option -O -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --ort-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --report-formats) - ;; - --copyright-garbage-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --custom-license-texts-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --how-to-fix-text-provider-script) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --license-classifications-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --package-configurations-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --refresh-resolutions) - ;; - --repository-configuration-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --resolutions-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --report-option) - ;; - --help) - ;; - esac -} - -_ort_requirements() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '-h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --help) - ;; - esac -} - -_ort_scan() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --ort-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' - continue - ;; - --input-path|-p) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--input-path' || in_param='' - continue - ;; - --output-dir|-o) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-dir' || in_param='' - continue - ;; - --output-formats|-f) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--output-formats' || in_param='' - continue - ;; - --label|-l) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--label' || in_param='' - continue - ;; - --scanners|-s) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--scanners' || in_param='' - continue - ;; - --project-scanners) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--project-scanners' || in_param='' - continue - ;; - --package-types) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--package-types' || in_param='' - continue - ;; - --skip-excluded) - __skip_opt_eq - in_param='' - continue - ;; - --resolutions-file) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--resolutions-file' || in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --input-path -p --output-dir -o --output-formats -f --label -l --scanners -s --project-scanners --package-types --skip-excluded --resolutions-file -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --ort-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --input-path) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-dir) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --output-formats) - COMPREPLY=($(compgen -W 'JSON XML YAML' -- "${word}")) - ;; - --label) - ;; - --scanners) - ;; - --project-scanners) - ;; - --package-types) - COMPREPLY=($(compgen -W 'PACKAGE PROJECT' -- "${word}")) - ;; - --skip-excluded) - ;; - --resolutions-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --help) - ;; - esac -} - -_ort_upload_curations() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --input-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--input-file' || in_param='' - continue - ;; - --server|-s) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--server' || in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--input-file -i --server -s -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --input-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --server) - COMPREPLY=($(compgen -W 'PRODUCTION DEVELOPMENT LOCAL' -- "${word}")) - ;; - --help) - ;; - esac -} - -_ort_upload_result_to_postgres() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --ort-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' - continue - ;; - --table-name) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--table-name' || in_param='' - continue - ;; - --column-name) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--column-name' || in_param='' - continue - ;; - --create-table) - __skip_opt_eq - in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --table-name --column-name --create-table -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --ort-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --table-name) - ;; - --column-name) - ;; - --create-table) - ;; - --help) - ;; - esac -} - -_ort_upload_result_to_sw360() { - local i=$1 - local in_param='' - local fixed_arg_names=() - local vararg_name='' - local can_parse_options=1 - - while [[ ${i} -lt $COMP_CWORD ]]; do - if [[ ${can_parse_options} -eq 1 ]]; then - case "${COMP_WORDS[$i]}" in - --) - can_parse_options=0 - (( i = i + 1 )); - continue - ;; - --ort-file|-i) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' - continue - ;; - --attach-sources|-a) - __skip_opt_eq - in_param='' - continue - ;; - -h|--help) - __skip_opt_eq - in_param='' - continue - ;; - esac - fi - case "${COMP_WORDS[$i]}" in - *) - (( i = i + 1 )) - # drop the head of the array - fixed_arg_names=("${fixed_arg_names[@]:1}") - ;; - esac - done - local word="${COMP_WORDS[$COMP_CWORD]}" - if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --attach-sources -a -h --help' -- "${word}")) - return - fi - - # We're either at an option's value, or the first remaining fixed size - # arg, or the vararg if there are no fixed args left - [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} - [[ -z "${in_param}" ]] && in_param=${vararg_name} - - case "${in_param}" in - --ort-file) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; - --attach-sources) - ;; - --help) - ;; - esac -} - -complete -F _ort ort diff --git a/integrations/completions/ort-completion.fish b/integrations/completions/ort-completion.fish index 102b37308eb5d..e7ec0d3ae2561 100644 --- a/integrations/completions/ort-completion.fish +++ b/integrations/completions/ort-completion.fish @@ -3,7 +3,7 @@ ### Setup for ort -set -l ort_subcommands 'advise analyze config download evaluate notify report requirements scan upload-curations upload-result-to-postgres upload-result-to-sw360' +set -l ort_subcommands 'advise analyze compare config download evaluate migrate notify report requirements scan upload-curations upload-result-to-postgres upload-result-to-sw360' ## Options for ort complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -l config -s c -r -F -d 'The path to a configuration file.' @@ -11,7 +11,7 @@ complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -l error - complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -l stacktrace -d 'Print out the stacktrace for all exceptions.' complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -s P -r -d 'Override a key-value pair in the configuration file. For example: -P ort.scanner.storages.postgres.connection.schema=testSchema' complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -l help-all -d 'Display help for all subcommands.' -complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -l generate-completion +complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -l generate-completion -r complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -l version -s v -d 'Show the version and exit.' complete -c ort -n "not __fish_seen_subcommand_from $ort_subcommands" -s h -l help -d 'Show this message and exit' @@ -40,18 +40,34 @@ complete -c ort -n "__fish_seen_subcommand_from analyze" -l output-formats -s f complete -c ort -n "__fish_seen_subcommand_from analyze" -l repository-configuration-file -r -F -d 'A file containing the repository configuration. If set, overrides any repository configuration contained in a \'.ort.yml\' file in the repository.' complete -c ort -n "__fish_seen_subcommand_from analyze" -l resolutions-file -r -F -d 'A file containing issue and rule violation resolutions.' complete -c ort -n "__fish_seen_subcommand_from analyze" -l label -s l -r -d 'Set a label in the ORT result, overwriting any existing label of the same name. Can be used multiple times. For example: --label distribution=external' +complete -c ort -n "__fish_seen_subcommand_from analyze" -l dry-run -d 'Do not actually run the project analysis but only show the package managers that would be used.' complete -c ort -n "__fish_seen_subcommand_from analyze" -s h -l help -d 'Show this message and exit' +### Setup for compare +complete -c ort -f -n __fish_use_subcommand -a compare -d 'Compare two ORT results with various methods.' + +## Options for compare +complete -c ort -n "__fish_seen_subcommand_from compare" -l method -s m -r -fa "SEMANTIC_DIFF TEXT_DIFF" -d 'The method to use when comparing ORT results. Must be one of [SEMANTIC_DIFF, TEXT_DIFF].' +complete -c ort -n "__fish_seen_subcommand_from compare" -l context-size -s C -r -d 'The number of unmodified lines to display in the context of a modified line. Only applies to unified diff output.' +complete -c ort -n "__fish_seen_subcommand_from compare" -l ignore-time -s t -d 'Ignore time differences.' +complete -c ort -n "__fish_seen_subcommand_from compare" -l ignore-environment -s e -d 'Ignore environment differences.' +complete -c ort -n "__fish_seen_subcommand_from compare" -l ignore-tmp-dir -s d -d 'Ignore temporary directory differences.' +complete -c ort -n "__fish_seen_subcommand_from compare" -s h -l help -d 'Show this message and exit' + +## Arguments for compare +complete -c ort -n "__fish_seen_subcommand_from compare" -F -d 'The first ORT result file to compare.' +complete -c ort -n "__fish_seen_subcommand_from compare" -F -d 'The second ORT result file to compare.' + + ### Setup for config -complete -c ort -f -n __fish_use_subcommand -a config -d 'Show different ORT configurations' +complete -c ort -f -n __fish_use_subcommand -a config -d 'Show different ORT configurations.' ## Options for config complete -c ort -n "__fish_seen_subcommand_from config" -l show-default -d 'Show the default configuration used when no custom configuration is present.' complete -c ort -n "__fish_seen_subcommand_from config" -l show-active -d 'Show the active configuration used, including any custom configuration.' complete -c ort -n "__fish_seen_subcommand_from config" -l show-reference -d 'Show the reference configuration. This configuration is never actually used as it just contains example entries for all supported configuration options.' complete -c ort -n "__fish_seen_subcommand_from config" -l check-syntax -r -F -d 'Check the syntax of the given configuration file.' -complete -c ort -n "__fish_seen_subcommand_from config" -l hocon-to-yaml -r -F -d 'Perform a simple conversion of the given HOCON configuration file to YAML and print the result.' complete -c ort -n "__fish_seen_subcommand_from config" -s h -l help -d 'Show this message and exit' @@ -72,6 +88,7 @@ complete -c ort -n "__fish_seen_subcommand_from download" -l archive-all -d 'Arc complete -c ort -n "__fish_seen_subcommand_from download" -l package-types -r -fa "PACKAGE PROJECT" -d 'A comma-separated list of the package types from the ORT file\'s analyzer result to limit downloads to.' complete -c ort -n "__fish_seen_subcommand_from download" -l package-ids -r -d 'A comma-separated list of regular expressions for matching package ids from the ORT file\'s analyzer result to limit downloads to. If not specified, all packages are downloaded.' complete -c ort -n "__fish_seen_subcommand_from download" -l skip-excluded -d 'Do not download excluded projects or packages. Works only with the \'--ort-file\' parameter.' +complete -c ort -n "__fish_seen_subcommand_from download" -l dry-run -d 'Do not actually download anything but just verify that all source code locations are valid.' complete -c ort -n "__fish_seen_subcommand_from download" -s h -l help -d 'Show this message and exit' @@ -87,8 +104,8 @@ complete -c ort -n "__fish_seen_subcommand_from evaluate" -l rules-resource -r - complete -c ort -n "__fish_seen_subcommand_from evaluate" -l copyright-garbage-file -r -F -d 'A file containing copyright statements which are marked as garbage.' complete -c ort -n "__fish_seen_subcommand_from evaluate" -l license-classifications-file -r -F -d 'A file containing the license classifications which are passed as parameter to the rules script.' complete -c ort -n "__fish_seen_subcommand_from evaluate" -l package-configurations-dir -r -F -d 'A directory that is searched recursively for package configuration files. Each file must only contain a single package configuration.' -complete -c ort -n "__fish_seen_subcommand_from evaluate" -l package-curations-file -r -F -d 'A file containing package curations. This replaces all package curations contained in the given ORT result file with the ones present in the given file and, if enabled, those from the package configuration.' -complete -c ort -n "__fish_seen_subcommand_from evaluate" -l package-curations-dir -r -F -d 'A directory containing package curation files. This replaces all package curations contained in the given ORT result file with the ones present in the given directory and, if enabled, those from the package configuration file.' +complete -c ort -n "__fish_seen_subcommand_from evaluate" -l package-curations-file -r -F -d 'A file containing package curations. This replaces all package curations contained in the given ORT result file with the ones present in the given file and, if enabled, those from the repository configuration.' +complete -c ort -n "__fish_seen_subcommand_from evaluate" -l package-curations-dir -r -F -d 'A directory containing package curation files. This replaces all package curations contained in the given ORT result file with the ones present in the given directory and, if enabled, those from the repository configuration.' complete -c ort -n "__fish_seen_subcommand_from evaluate" -l repository-configuration-file -r -F -d 'A file containing the repository configuration. If set, overrides the repository configuration contained in the ORT result input file.' complete -c ort -n "__fish_seen_subcommand_from evaluate" -l resolutions-file -r -F -d 'A file containing issue and rule violation resolutions.' complete -c ort -n "__fish_seen_subcommand_from evaluate" -l label -s l -r -d 'Set a label in the ORT result, overwriting any existing label of the same name. Can be used multiple times. For example: --label distribution=external' @@ -96,6 +113,15 @@ complete -c ort -n "__fish_seen_subcommand_from evaluate" -l check-syntax -d 'Do complete -c ort -n "__fish_seen_subcommand_from evaluate" -s h -l help -d 'Show this message and exit' +### Setup for migrate +complete -c ort -f -n __fish_use_subcommand -a migrate -d 'Assist with migrating ORT configuration to newer ORT versions.' + +## Options for migrate +complete -c ort -n "__fish_seen_subcommand_from migrate" -l hocon-to-yaml -r -F -d 'Perform a simple conversion of the given HOCON configuration file to YAML and print the result.' +complete -c ort -n "__fish_seen_subcommand_from migrate" -l nuget-ids -r -F -d 'Convert NuGet package IDs in curations and configurations to the new format that includes a namespace.' +complete -c ort -n "__fish_seen_subcommand_from migrate" -s h -l help -d 'Show this message and exit' + + ### Setup for notify complete -c ort -f -n __fish_use_subcommand -a notify -d 'Create notifications based on an ORT result.' @@ -113,7 +139,7 @@ complete -c ort -f -n __fish_use_subcommand -a report -d 'Present Analyzer, Scan ## Options for report complete -c ort -n "__fish_seen_subcommand_from report" -l ort-file -s i -r -F -d 'The ORT result file to use.' complete -c ort -n "__fish_seen_subcommand_from report" -l output-dir -s o -r -F -d 'The output directory to store the generated reports in.' -complete -c ort -n "__fish_seen_subcommand_from report" -l report-formats -s f -r -d 'The comma-separated reports to generate, any of [CtrlXAutomation, CycloneDx, DocBookTemplate, EvaluatedModel, FossId, GitLabLicenseModel, HtmlTemplate, ManPageTemplate, Opossum, PdfTemplate, PlainTextTemplate, SpdxDocument, StaticHtml, WebApp].' +complete -c ort -n "__fish_seen_subcommand_from report" -l report-formats -s f -r -d 'The comma-separated reports to generate, any of [CtrlXAutomation, CycloneDx, DocBookTemplate, EvaluatedModel, FossId, FossIdSnippet, GitLabLicenseModel, HtmlTemplate, ManPageTemplate, Opossum, PdfTemplate, PlainTextTemplate, SpdxDocument, StaticHtml, TrustSource, WebApp].' complete -c ort -n "__fish_seen_subcommand_from report" -l copyright-garbage-file -r -F -d 'A file containing copyright statements which are marked as garbage. This can make the output inconsistent with the evaluator output but is useful when testing copyright garbage.' complete -c ort -n "__fish_seen_subcommand_from report" -l custom-license-texts-dir -r -F -d 'A directory which maps custom license IDs to license texts. It should contain one text file per license with the license ID as the filename. A custom license text is used only if its ID has a \'LicenseRef-\' prefix and if the respective license text is not known by ORT.' complete -c ort -n "__fish_seen_subcommand_from report" -l how-to-fix-text-provider-script -r -F -d 'The path to a Kotlin script which returns an instance of a \'HowToFixTextProvider\'. That provider injects how-to-fix texts in Markdown format for ORT issues.' @@ -130,6 +156,7 @@ complete -c ort -n "__fish_seen_subcommand_from report" -s h -l help -d 'Show th complete -c ort -f -n __fish_use_subcommand -a requirements -d 'Check for the command line tools required by ORT.' ## Options for requirements +complete -c ort -n "__fish_seen_subcommand_from requirements" -l list -s l -r -fa "PLUGINS COMMANDS" -d 'A comma-separated list of requirements to list.' complete -c ort -n "__fish_seen_subcommand_from requirements" -s h -l help -d 'Show this message and exit' @@ -138,7 +165,6 @@ complete -c ort -f -n __fish_use_subcommand -a scan -d 'Run external license / c ## Options for scan complete -c ort -n "__fish_seen_subcommand_from scan" -l ort-file -s i -r -F -d 'An ORT result file with an analyzer result to use. Source code is downloaded automatically if needed. Must not be used together with \'--input-path\'.' -complete -c ort -n "__fish_seen_subcommand_from scan" -l input-path -s p -r -F -d 'An input directory or file to scan. Must not be used together with \'--ort-file\'.' complete -c ort -n "__fish_seen_subcommand_from scan" -l output-dir -s o -r -F -d 'The directory to write the ORT result file with scan results to.' complete -c ort -n "__fish_seen_subcommand_from scan" -l output-formats -s f -r -fa "JSON XML YAML" -d 'The list of output formats to be used for the ORT result file(s).' complete -c ort -n "__fish_seen_subcommand_from scan" -l label -s l -r -d 'Set a label in the ORT result, overwriting any existing label of the same name. Can be used multiple times. For example: --label distribution=external' @@ -155,7 +181,7 @@ complete -c ort -f -n __fish_use_subcommand -a upload-curations -d 'Upload ORT p ## Options for upload-curations complete -c ort -n "__fish_seen_subcommand_from upload-curations" -l input-file -s i -r -F -d 'The file with package curations to upload.' -complete -c ort -n "__fish_seen_subcommand_from upload-curations" -l server -s s -r -fa "PRODUCTION DEVELOPMENT LOCAL" -d 'The ClearlyDefined server to upload to.' +complete -c ort -n "__fish_seen_subcommand_from upload-curations" -l server -s s -r -fa "PRODUCTION DEVELOPMENT LOCAL" -d 'The ClearlyDefined server to upload to. Must be one of [PRODUCTION, DEVELOPMENT, LOCAL].' complete -c ort -n "__fish_seen_subcommand_from upload-curations" -s h -l help -d 'Show this message and exit' diff --git a/integrations/completions/ort-completion.zsh b/integrations/completions/ort-completion.zsh index a3083d0d7b32e..abe80d4314b5b 100644 --- a/integrations/completions/ort-completion.zsh +++ b/integrations/completions/ort-completion.zsh @@ -83,6 +83,10 @@ _ort() { _ort_analyze $(( i + 1 )) return ;; + compare) + _ort_compare $(( i + 1 )) + return + ;; config) _ort_config $(( i + 1 )) return @@ -95,6 +99,10 @@ _ort() { _ort_evaluate $(( i + 1 )) return ;; + migrate) + _ort_migrate $(( i + 1 )) + return + ;; notify) _ort_notify $(( i + 1 )) return @@ -160,7 +168,7 @@ _ort() { --help) ;; *) - COMPREPLY=($(compgen -W 'advise analyze config download evaluate notify report requirements scan upload-curations upload-result-to-postgres upload-result-to-sw360' -- "${word}")) + COMPREPLY=($(compgen -W 'advise analyze compare config download evaluate migrate notify report requirements scan upload-curations upload-result-to-postgres upload-result-to-sw360' -- "${word}")) ;; esac } @@ -322,6 +330,11 @@ _ort_analyze() { [[ ${i} -gt COMP_CWORD ]] && in_param='--label' || in_param='' continue ;; + --dry-run) + __skip_opt_eq + in_param='' + continue + ;; -h|--help) __skip_opt_eq in_param='' @@ -339,7 +352,7 @@ _ort_analyze() { done local word="${COMP_WORDS[$COMP_CWORD]}" if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--input-dir -i --output-dir -o --output-formats -f --repository-configuration-file --resolutions-file --label -l -h --help' -- "${word}")) + COMPREPLY=($(compgen -W '--input-dir -i --output-dir -o --output-formats -f --repository-configuration-file --resolutions-file --label -l --dry-run -h --help' -- "${word}")) return fi @@ -366,8 +379,101 @@ _ort_analyze() { ;; --label) ;; + --dry-run) + ;; + --help) + ;; + esac +} + +_ort_compare() { + local i=$1 + local in_param='' + local fixed_arg_names=('FILEA' 'FILEB') + local vararg_name='' + local can_parse_options=1 + + while [[ ${i} -lt $COMP_CWORD ]]; do + if [[ ${can_parse_options} -eq 1 ]]; then + case "${COMP_WORDS[$i]}" in + --) + can_parse_options=0 + (( i = i + 1 )); + continue + ;; + --method|-m) + __skip_opt_eq + (( i = i + 1 )) + [[ ${i} -gt COMP_CWORD ]] && in_param='--method' || in_param='' + continue + ;; + --context-size|-C) + __skip_opt_eq + (( i = i + 1 )) + [[ ${i} -gt COMP_CWORD ]] && in_param='--context-size' || in_param='' + continue + ;; + --ignore-time|-t) + __skip_opt_eq + in_param='' + continue + ;; + --ignore-environment|-e) + __skip_opt_eq + in_param='' + continue + ;; + --ignore-tmp-dir|-d) + __skip_opt_eq + in_param='' + continue + ;; + -h|--help) + __skip_opt_eq + in_param='' + continue + ;; + esac + fi + case "${COMP_WORDS[$i]}" in + *) + (( i = i + 1 )) + # drop the head of the array + fixed_arg_names=("${fixed_arg_names[@]:1}") + ;; + esac + done + local word="${COMP_WORDS[$COMP_CWORD]}" + if [[ "${word}" =~ ^[-] ]]; then + COMPREPLY=($(compgen -W '--method -m --context-size -C --ignore-time -t --ignore-environment -e --ignore-tmp-dir -d -h --help' -- "${word}")) + return + fi + + # We're either at an option's value, or the first remaining fixed size + # arg, or the vararg if there are no fixed args left + [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} + [[ -z "${in_param}" ]] && in_param=${vararg_name} + + case "${in_param}" in + --method) + COMPREPLY=($(compgen -W 'SEMANTIC_DIFF TEXT_DIFF' -- "${word}")) + ;; + --context-size) + ;; + --ignore-time) + ;; + --ignore-environment) + ;; + --ignore-tmp-dir) + ;; --help) ;; + FILEA) + COMPREPLY=($(compgen -o default -- "${word}")) + ;; + FILEB) + COMPREPLY=($(compgen -o default -- "${word}")) + ;; esac } @@ -407,12 +513,6 @@ _ort_config() { [[ ${i} -gt COMP_CWORD ]] && in_param='--check-syntax' || in_param='' continue ;; - --hocon-to-yaml) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--hocon-to-yaml' || in_param='' - continue - ;; -h|--help) __skip_opt_eq in_param='' @@ -430,7 +530,7 @@ _ort_config() { done local word="${COMP_WORDS[$COMP_CWORD]}" if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--show-default --show-active --show-reference --check-syntax --hocon-to-yaml -h --help' -- "${word}")) + COMPREPLY=($(compgen -W '--show-default --show-active --show-reference --check-syntax -h --help' -- "${word}")) return fi @@ -449,9 +549,6 @@ _ort_config() { --check-syntax) COMPREPLY=($(compgen -o default -- "${word}")) ;; - --hocon-to-yaml) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; --help) ;; esac @@ -547,6 +644,11 @@ _ort_download() { in_param='' continue ;; + --dry-run) + __skip_opt_eq + in_param='' + continue + ;; -h|--help) __skip_opt_eq in_param='' @@ -564,7 +666,7 @@ _ort_download() { done local word="${COMP_WORDS[$COMP_CWORD]}" if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --project-url --project-name --vcs-type --vcs-revision --vcs-path --license-classifications-file --output-dir -o --archive --archive-all --package-types --package-ids --skip-excluded -h --help' -- "${word}")) + COMPREPLY=($(compgen -W '--ort-file -i --project-url --project-name --vcs-type --vcs-revision --vcs-path --license-classifications-file --output-dir -o --archive --archive-all --package-types --package-ids --skip-excluded --dry-run -h --help' -- "${word}")) return fi @@ -604,6 +706,8 @@ _ort_download() { ;; --skip-excluded) ;; + --dry-run) + ;; --help) ;; esac @@ -778,6 +882,71 @@ _ort_evaluate() { esac } +_ort_migrate() { + local i=$1 + local in_param='' + local fixed_arg_names=() + local vararg_name='' + local can_parse_options=1 + + while [[ ${i} -lt $COMP_CWORD ]]; do + if [[ ${can_parse_options} -eq 1 ]]; then + case "${COMP_WORDS[$i]}" in + --) + can_parse_options=0 + (( i = i + 1 )); + continue + ;; + --hocon-to-yaml) + __skip_opt_eq + (( i = i + 1 )) + [[ ${i} -gt COMP_CWORD ]] && in_param='--hocon-to-yaml' || in_param='' + continue + ;; + --nuget-ids) + __skip_opt_eq + (( i = i + 1 )) + [[ ${i} -gt COMP_CWORD ]] && in_param='--nuget-ids' || in_param='' + continue + ;; + -h|--help) + __skip_opt_eq + in_param='' + continue + ;; + esac + fi + case "${COMP_WORDS[$i]}" in + *) + (( i = i + 1 )) + # drop the head of the array + fixed_arg_names=("${fixed_arg_names[@]:1}") + ;; + esac + done + local word="${COMP_WORDS[$COMP_CWORD]}" + if [[ "${word}" =~ ^[-] ]]; then + COMPREPLY=($(compgen -W '--hocon-to-yaml --nuget-ids -h --help' -- "${word}")) + return + fi + + # We're either at an option's value, or the first remaining fixed size + # arg, or the vararg if there are no fixed args left + [[ -z "${in_param}" ]] && in_param=${fixed_arg_names[0]} + [[ -z "${in_param}" ]] && in_param=${vararg_name} + + case "${in_param}" in + --hocon-to-yaml) + COMPREPLY=($(compgen -o default -- "${word}")) + ;; + --nuget-ids) + COMPREPLY=($(compgen -o default -- "${word}")) + ;; + --help) + ;; + esac +} + _ort_notify() { local i=$1 local in_param='' @@ -1026,6 +1195,12 @@ _ort_requirements() { (( i = i + 1 )); continue ;; + --list|-l) + __skip_opt_eq + (( i = i + 1 )) + [[ ${i} -gt COMP_CWORD ]] && in_param='--list' || in_param='' + continue + ;; -h|--help) __skip_opt_eq in_param='' @@ -1043,7 +1218,7 @@ _ort_requirements() { done local word="${COMP_WORDS[$COMP_CWORD]}" if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '-h --help' -- "${word}")) + COMPREPLY=($(compgen -W '--list -l -h --help' -- "${word}")) return fi @@ -1053,6 +1228,9 @@ _ort_requirements() { [[ -z "${in_param}" ]] && in_param=${vararg_name} case "${in_param}" in + --list) + COMPREPLY=($(compgen -W 'PLUGINS COMMANDS' -- "${word}")) + ;; --help) ;; esac @@ -1079,12 +1257,6 @@ _ort_scan() { [[ ${i} -gt COMP_CWORD ]] && in_param='--ort-file' || in_param='' continue ;; - --input-path|-p) - __skip_opt_eq - (( i = i + 1 )) - [[ ${i} -gt COMP_CWORD ]] && in_param='--input-path' || in_param='' - continue - ;; --output-dir|-o) __skip_opt_eq (( i = i + 1 )) @@ -1149,7 +1321,7 @@ _ort_scan() { done local word="${COMP_WORDS[$COMP_CWORD]}" if [[ "${word}" =~ ^[-] ]]; then - COMPREPLY=($(compgen -W '--ort-file -i --input-path -p --output-dir -o --output-formats -f --label -l --scanners -s --project-scanners --package-types --skip-excluded --resolutions-file -h --help' -- "${word}")) + COMPREPLY=($(compgen -W '--ort-file -i --output-dir -o --output-formats -f --label -l --scanners -s --project-scanners --package-types --skip-excluded --resolutions-file -h --help' -- "${word}")) return fi @@ -1162,9 +1334,6 @@ _ort_scan() { --ort-file) COMPREPLY=($(compgen -o default -- "${word}")) ;; - --input-path) - COMPREPLY=($(compgen -o default -- "${word}")) - ;; --output-dir) COMPREPLY=($(compgen -o default -- "${word}")) ;;