SUSE/saptune

View on GitHub
ospackage/usr/share/bash-completion/completions/build/saptune-completion.yaml__started_rewrite_for_=.experimental

Summary

Maintainability
Test Coverage
# This is the input configuration for 'completely' (https://github.com/DannyBen/completely)
# to generate the bash completion script.
#
# v2.2
#
# Changelog:    29.09.2022  v2.0  - first release for saptune 3.1
#               21.11.2022  v2.1  - Replace --output with --format in syntax description
#                                 - Add `saptune solution change [--force]`
#               22.11.2022  v2.2  - "simple/dumb" implementation of  `--colorscheme` and `--format` due to the = problem (see "Caveats" below)
#
# Syntax:       saptune [--format=FORMAT] help
#               saptune [--format=FORMAT] version  
#               saptune [--format=FORMAT] status [--non-compliance-check] 
#               saptune [--format=FORMAT] daemon ( start | stop | status [--non-compliance-check] )
#               saptune [--format=FORMAT] service ( start | stop | restart | takeover | enable | disable | enablestart | disablestop | status [--non-compliance-check] )
#               saptune [--format=FORMAT] note ( list | revertall | enabled | applied )
#               saptune [--format=FORMAT] note ( apply | simulate | customise | create | edit | revert | show | delete ) NOTEID
#               saptune [--format=FORMAT] note verify [--colorscheme=SCHEME] [--show-non-compliant] [NOTEID]
#               saptune [--format=FORMAT] note rename NOTEID NEWNOTEID
#               saptune [--format=FORMAT] solution ( list | verify | enabled | applied )
#               saptune [--format=FORMAT] solution ( apply | simulate | customise | create | edit | revert | show | delete | change [--force] ) SOLUTIONNAME
#               saptune [--format=FORMAT] solution verify [--colorscheme=SCHEME] [--show-non-compliant] [SOLUTIONID]
#               saptune [--format=FORMAT] solution rename SOLUTIONNAME NEWSSOLUTIONNAME
#               saptune [--format=FORMAT] staging ( status | enable | disable | is-enabled | list )
#               saptune [--format=FORMAT] staging ( analysis | diff ) [ ( NOTEID | SOLUTIONNAME )... | all ]
#               saptune [--format=FORMAT] staging release [--force|--dry-run] [ ( NOTEID | SOLUTIONNAME )... | all ]
#               saptune [--format=FORMAT] revert all
#               saptune [--format=FORMAT] lock remove
#               saptune [--format=FORMAT] check
#
#
# Caveats:      - It is not possible to use the '=' sign in options. Completion will stop at the '=' sign.
#                 (Using backspace to overwrite the space doesn't work. The completions prints the code.
#                 There is a way to implement this (https://www.gnu.org/software/gnuastro/manual/html_node/Bash-TAB-completion-tutorial.html),
#                 but trying it out and rewriting the code would cost to much time for now.
#
#               - It is not feasible to support the option ('--format FORMAT') which has to come immediately after 'saptune'
#                 Each combination must be listed in this file, which would double the current entries. 
#                 The support for this must be added to the generated script later.
#
#               - The completely resolved command needs to have a dummy entry: '$()' (empty command) to stop further
#                 processing.
#
#
# ToDo :        - Implementing support for the `=` sign.



# --- First level ---
saptune:
  #- --format
  - --format=json
  - help
  - version  
  - status
  - daemon
  - service
  - note
  - solution
  - staging
  - revert
  - lock
  - check

# --- start: support for global format option ---
#
# THIS BLOCK PREVENTS A WORKABLE SOLUTION WITH THE REST
# OF THE DEFINITION UNLESS THE FOLLOWING BLOCK GETS ADDED
# TO THE RESULTING SCRIPT AS FIRST LINES OF THE FUNCTION
# '_saptune_completions()':
#
#   if [[ "${COMP_WORDS[*]}" =~ ^saptune\ --format\ =\ json ]] ; then
#     unset COMP_WORDS[1]  # remove '--format'
#     unset COMP_WORDS[2]  # remove '='
#     unset COMP_WORDS[3]  # remove 'json'
#     COMP_WORDS=( ${COMP_WORDS[@]} )
#     ((COMP_CWORD-=3))
#   fi
#
# THIS IS CURRENTLY THE ONLY WAY TO SUPPORT THE FORMAT
# OPTION WITHOUT LETTING THE AMOUNT OF DEFINITIONS IN THIS
# FILE EXPLODE.

# saptune --format:
#   - json

#saptune --format *:
saptune --format=json *:
  - help
  - version  
  - status
  - daemon
  - service
  - note
  - solution
  - staging
  - revert
  - lock
  - check

# --- end: support for global format option ---

# --- saptune help ---
saptune help:
  - $()


# --- saptune version ---
saptune version:
  - $()


# --- saptune status ---
saptune status:
  - --non-compliance-check
  - $()

saptune status --non-compliance-check:
  - $()

# --- saptune daemon ---
saptune daemon:
  - start
  - stop
  - status

saptune daemon start: &stop
  - $()

saptune daemon stop: *stop

saptune daemon status:
  - --non-compliance-check
  - $()

saptune daemon status --non-compliance-check: *stop


# --- saptune service ---
saptune service:
  - start
  - stop
  - restart 
  - takeover 
  - enable 
  - disable 
  - enablestart 
  - disablestop 
  - status 

saptune service start: &stop
  - $()

saptune service stop: *stop

saptune service restart: *stop

saptune service takeover: *stop

saptune service enable: *stop

saptune service disable: *stop

saptune service enablestart: *stop

saptune service disablestop: *stop

saptune service status:
  - --non-compliance-check
  - $()

saptune service status*--non-compliance-check: *stop


# --- saptune note ---
saptune note:
  - list
  - revertall
  - enabled
  - applied
  - apply
  - simulate
  - customise
  - create
  - edit
  - revert
  - show
  - delete
  - verify
  - rename

saptune note list: &stop
  - $()

saptune note revertall: *stop

saptune note enabled: *stop

saptune note applied: *stop

saptune note apply: &list-all-notes
  - $(ls /var/lib/saptune/working/notes/ ; ls /etc/saptune/extra)

saptune note apply *: *stop

saptune note simulate: *list-all-notes

saptune note simulate *: *stop

saptune note customise: *list-all-notes

saptune note customise *: *stop

saptune note create: *list-all-notes

saptune note create *: *stop

saptune note edit: *list-all-notes

saptune note edit *: *stop

saptune note revert: *list-all-notes

saptune note revert *: *stop

saptune note show: *list-all-notes

saptune note show *: *stop

saptune note delete: *list-all-notes

saptune note delete *: *stop

saptune note verify: 
  #- --colorscheme
  - --colorscheme=full-green-zebra
  - --colorscheme=full-blue-zebra
  - --colorscheme=cmpl-green-zebra
  - --colorscheme=cmpl-blue-zebra
  - --colorscheme=full-red-noncmpl
  - --colorscheme=full-yellow-noncmpl
  - --colorscheme=red-noncmpl
  - --colorscheme=yellow-noncmpl
  - --show-non-compliant
  - $(ls /var/lib/saptune/working/notes ; ls /etc/saptune/extra)

saptune note verify *: *stop
  
# saptune note verify --show-non-compliant:
#   - --colorscheme
#   - $(ls /var/lib/saptune/working/notes ; ls /etc/saptune/extra)

saptune note verify --show-non-compliant *: *stop

# saptune note verify --show-non-compliant --colorscheme: &color-schemes
#   - full-green-zebra
#   - full-blue-zebra
#   - cmpl-green-zebra
#   - cmpl-blue-zebra
#   - full-red-noncmpl
#   - full-yellow-noncmpl
#   - red-noncmpl
#   - yellow-noncmpl

#saptune note verify --show-non-compliant --colorscheme *: *list-all-notes

#saptune note verify --show-non-compliant --colorscheme * *: *stop

#saptune note verify --colorscheme=: *color-schemes

#saptune note verify --colorscheme *:
#  - --show-non-compliant
#  - $(ls /var/lib/saptune/working/notes ; ls /etc/saptune/extra)

#saptune note verify --colorscheme * *: *stop

#saptune note verify --colorscheme * --show-non-compliant: *list-all-notes

#saptune note verify --colorscheme * --show-non-compliant *: *stop

saptune note rename: *list-all-notes

saptune note rename *: *stop 


# --- saptune solution ---
saptune solution:
  - list
  - enabled
  - applied
  - apply
  - simulate
  - customise
  - create
  - edit
  - revert
  - show
  - delete
  - change
  - verify
  - rename

saptune solution list: &stop
  - $()

saptune solution enabled: *stop

saptune solution applied: *stop

saptune solution apply: &list-all-solutions
  - $(find   /var/lib/saptune/working/sols /etc/saptune/extra/ -name '*.sol' -printf '%P ' | sed 's/\.sol//g')

saptune solution apply *: *stop

saptune solution simulate: *list-all-solutions

saptune solution simulate *: *stop

saptune solution customise: *list-all-solutions

saptune solution customise *: *stop

saptune solution create: *list-all-solutions

saptune solution create *: *stop

saptune solution edit: *list-all-solutions

saptune solution edit *: *stop

saptune solution revert: *list-all-solutions

saptune solution revert *: *stop

saptune solution show: *list-all-solutions

saptune solution show *: *stop

saptune solution delete: *list-all-solutions

saptune solution delete *: *stop

saptune solution change: 
  - --force
  - $(find /var/lib/saptune/working/sols/ /etc/saptune/extra/ -name '*.sol' -printf '%P ' | sed 's/\.sol//g')

saptune solution change --force: *list-all-solutions

saptune solution change *: *stop

saptune solution change --force *: *stop 

saptune solution verify: 
  - --colorscheme
  - --show-non-compliant
  - $(find /var/lib/saptune/working/sols/ /etc/saptune/extra/ -name '*.sol' -printf '%P ' | sed 's/\.sol//g')

saptune solution verify *: *stop
  
saptune solution verify --show-non-compliant:
  - --colorscheme
  - $(find /var/lib/saptune/working/sols/ /etc/saptune/extra/ -name '*.sol' -printf '%P ' | sed 's/\.sol//g')

saptune solution verify --show-non-compliant *: *stop

saptune solution verify --show-non-compliant --colorscheme: &color-schemes
  - full-green-zebra
  - full-blue-zebra
  - cmpl-green-zebra
  - cmpl-blue-zebra
  - full-red-noncmpl
  - full-yellow-noncmpl
  - red-noncmpl
  - yellow-noncmpl

saptune solution verify --show-non-compliant --colorscheme *: *list-all-solutions

saptune solution verify --show-non-compliant --colorscheme * *: *stop

saptune solution verify --colorscheme: *color-schemes

saptune solution verify --colorscheme *:
  - --show-non-compliant
  - $(find /var/lib/saptune/working/sols/ /etc/saptune/extra/ -name '*.sol' -printf '%P ' | sed 's/\.sol//g')

saptune solution verify --colorscheme * *: *stop

saptune solution verify --colorscheme * --show-non-compliant: *list-all-solutions

saptune solution verify --colorscheme * --show-non-compliant *: *stop

saptune solution rename: *list-all-solutions

saptune solution rename *: *stop 



# --- saptune staging ---
saptune staging:
  - status
  - enable
  - disable
  - is-enabled
  - list
  - diff
  - analysis
  - release

saptune staging status:
  - $()

saptune staging enable:
  - $()

saptune staging disable:
  - $()

saptune staging is-enabled:
  - $()

saptune staging list:
  - $()


saptune staging diff:
  - $(find /var/lib/saptune/staging/latest/ -printf '%P ' | sed 's/\.sol//g')
  - all
  
saptune staging diff *:
  - $(find /var/lib/saptune/staging/latest/ -printf '%P ' | sed 's/\.sol//g')

saptune staging diff all:
  - $()

saptune staging analysis:
  - $(find /var/lib/saptune/staging/latest/ -printf '%P ' | sed 's/\.sol//g')
  - all
  
saptune staging analysis *:
  - $(find /var/lib/saptune/staging/latest/ -printf '%P ' | sed 's/\.sol//g')

saptune staging analysis all:
  - $()

saptune staging release:
  - --force
  - --dry-run
  - $(find /var/lib/saptune/staging/latest/ -printf '%P ' | sed 's/\.sol//g')
  - all

saptune staging release --force:
  - $(find /var/lib/saptune/staging/latest/ -printf '%P ' | sed 's/\.sol//g')
  - all

saptune staging release --force all:
  - $()

saptune staging release --dry-run:
  - $(find /var/lib/saptune/staging/latest/ -printf '%P ' | sed 's/\.sol//g')
  - all

saptune staging release --dry-run all:
  - $()

saptune staging release *:
  - $(find /var/lib/saptune/staging/latest/ -printf '%P ' | sed 's/\.sol//g')

saptune staging release all:
  - $()


# --- saptune revert ---
saptune revert:
  - all 

saptune revert all:
  - $()


# --- saptune lock ---
saptune lock:
  - remove

saptune lock remove: 
  - $()


# --- saptune check ---
saptune check: 
  - $()