[UPD] script db_restore: better description help

- show nothing when nothing to do
This commit is contained in:
Mathieu Benoit 2023-01-17 21:44:30 -05:00
parent ad0c9b24fb
commit 2732942633

View file

@ -22,21 +22,25 @@ def get_config():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawDescriptionHelpFormatter,
description="""\ description="""\
Restore database, use cache to clone to improve speed. DESCRIPTION
Restore database, use cache to clone to improve speed.
SUGGESTION
./script/database/db_restore.py -d test
""", """,
epilog="""\ epilog="""\
""", """,
) )
# parser.add_argument('-d', '--dir', dest="dir", default="./", # parser.add_argument('-d', '--dir', dest="dir", default="./",
# help="Path of repo to change remote, including submodule.") # help="Path of repo to change remote, including submodule.")
parser.add_argument("--database", help="Database to manipulate.") parser.add_argument("-d", "--database", help="Database to manipulate.")
parser.add_argument( parser.add_argument(
"--image", "--image",
default="erplibre_base", default="erplibre_base",
help=( help=(
"Image name to restore, from directory image_db, filename without" "Image name to restore, from directory image_db, filename without"
" '.zip'. Example, use erplibre_base to use image" " '.zip'. Example, use erplibre_base to use image"
" erplibre_base.zip." " erplibre_base.zip. Default value is erplibre_base"
), ),
) )
parser.add_argument( parser.add_argument(
@ -134,6 +138,9 @@ def main():
out = check_output(arg.split(" ")).decode() out = check_output(arg.split(" ")).decode()
print(out) print(out)
if not config.clean_cache and not config.database:
print("Nothing to do.")
if __name__ == "__main__": if __name__ == "__main__":
main() main()