Coverage for pyquickhelper/cli/pyq_sync_cli.py: 100%
12 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-03 02:21 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-03 02:21 +0200
1"""
2@file
3@brief Wrapper function @see fn synchronize_folder into a command line.
4"""
5from __future__ import print_function
6import os
7import sys
8import warnings
11def pyq_sync(fLOG=print, args=None):
12 """
13 Synchronizes a folder using function @see fn synchronize_folder.
15 @param fLOG logging function
16 @param args to overwrite ``sys.args``
18 .. cmdref::
19 :title: Synchronize two folders
20 :cmd: pyquickhelper.cli.pyq_sync_cli:pyq_sync
22 Synchronizes two folders from the command line.
23 """
24 with warnings.catch_warnings():
25 warnings.simplefilter("ignore", ImportWarning)
26 try:
27 from pyquickhelper.filehelper.synchelper import synchronize_folder
28 from pyquickhelper.cli.cli_helper import call_cli_function
29 except ImportError: # pragma: no cover
30 folder = os.path.normpath(os.path.join(
31 os.path.abspath(os.path.dirname(__file__)), "..", ".."))
32 sys.path.append(folder)
33 from pyquickhelper.filehelper.synchelper import synchronize_folder
34 from pyquickhelper.cli.cli_helper import call_cli_function
36 call_cli_function(synchronize_folder, args=args, fLOG=fLOG,
37 skip_parameters=('fLOG', 'operations', 'log1'))
40if __name__ == "__main__":
41 pyq_sync() # pragma: no cover