SUSE/saptune

View on GitHub
ospackage/usr/share/bash-completion/completions/build/README.md

Summary

Maintainability
Test Coverage
The bash-completion for saptune now will be generated by 'completely' (https://github.com/DannyBen/completely).
Either use the docker container or install the package on ab OS witch has the required Ruby version. 
SLES or OpenLeap is not among them. :-/


1. Maintain `saptune-completion.yaml` which describes the arguments and options of saptune.

2. Generate a new completion script by running: `completely generate saptune-completion.yaml saptune.completion`

3. Add the following lines to the generated completion script at the **beginning** of the function `_saptune_completions()`:

      ```
      if [[ "${COMP_WORDS[*]}" =~ ^saptune\ --format\ json ]] ; then
            unset COMP_WORDS[1]  # remove '--format'
            unset COMP_WORDS[2]  # remove 'json'
            COMP_WORDS=( ${COMP_WORDS[@]} )
            ((COMP_CWORD-=2))
      fi
      ```

Step 2 and 3 are done by the script `build` (uses the completely docker container):

```
./build
```  
The bash completion generated by `completely` is `saptune.completion.compiled` and the bash completion enhanced with the scriptlet (and therefore the final completion) is `saptune.completion`.