1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

feat(cmapi, mcs): MCOL-5941 Improve mcs cli backup\restore wrapper.

* fix(mcs, wrapper): default is None for --backup-location, --backup-destination, --storage, --parallel, --highavilability, --skip-save-brm, --skip-polls, --skip-locks, --skip-mariadb-backup, --skip-bucket-data, --name-backup, --quiet, --no-verify-ssl, --poll-interval, --poll-max-wait, --retention-days, -scp, -bb, -url, -f, -m, -aro, -li and most of arguments in backup_commands.py and restore_commands.py
* fix(mcs, helpers): cook_sh_arg parser function now detects None as a value
* fix(mcs, wrapper): list -> li in typer command argument name for both backup_commands.py and restore_commands.py
* docs(mcs, wrapper): --parralel arg help message was edited to simple and readable one
* fix(mcs, wrapper): removing -no- prefixed flag variants for all bool arguments in backup_commands.py and restore_commands.py
This commit is contained in:
mariadb-AlanMologorsky
2025-04-15 05:59:22 +03:00
committed by drrtuy
parent d5c8b98162
commit 927eb4b2bd
3 changed files with 186 additions and 148 deletions

View File

@ -1,22 +1,27 @@
"""Module with helper functions for mcs cli tool."""
from typing import Union
from typing import Optional, Union
def cook_sh_arg(arg_name: str, value:Union[str, int, bool]) -> str:
def cook_sh_arg(arg_name: str, value: Union[str, int, bool]) -> Optional[str]:
"""Convert argument and and value from function locals to bash argument.
:param arg_name: function argument name
:type arg_name: str
:param value: function argument value
:type value: Union[str, int, bool]
:return: bash argument string
:rtype: str
:return: bash argument string or None
:rtype: Optional[str]
"""
# skip "arguments" list and Typer ctx variables from local scope
if arg_name in ('arguments', 'ctx'):
return None
# skip args that have empty string as value
if value == '':
# skip args that have empty string or None as value
# Condition below could be "not value", but I prefer to be explicit
# and check for empty string and None to show that it's different cases:
# empty string means that user passed empty string as value
# and None means that user didn't pass anything and our internal None
# applies
if value == '' or value is None:
return None
if '_' in arg_name:
arg_name = arg_name.replace('_', '-')