sdpython / pyquickhelper

Automation to publish materials for teaching, notebook rendering, sphinx extensions, Jenkins helpers...
http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/
MIT License
20 stars 10 forks source link

pyq-sync cli breaks when args is not iterable #340

Closed janjagusch closed 3 years ago

janjagusch commented 3 years ago
pyq-sync --help
usage: synchronize_folder [-h] [--p1 P1] [--p2 P2] [-ha HASH_SIZE] [-r REPO1] [-re REPO2] [-s SIZE_DIFFERENT] [-n NO_DELETION] [-f FILTER] [-fi FILTER_COPY] [-a AVOID_COPY]
                          [-fil FILE_DATE] [-c COPY_1TO2] [-cr CREATE_DEST]

Synchronizes two folders (or copy if the second is empty), it only copies more recent files. It can walk through a `git` repository or SVN.

optional arguments:
  -h, --help            show this help message and exit
  --p1 P1               (str) first path (default: None)
  --p2 P2               (str) second path (default: None)
  -ha HASH_SIZE, --hash_size HASH_SIZE
                        (bool) to check whether or not two files are different (default: 1048576)
  -r REPO1, --repo1 REPO1
                        (bool) assuming the first folder is under SVN or GIT, it uses pysvn to get the list of files (avoiding any extra files) (default: False)
  -re REPO2, --repo2 REPO2
                        (bool) assuming the second folder is under SVN or GIT, it uses pysvn to get the list of files (avoiding any extra files) (default: False)
  -s SIZE_DIFFERENT, --size_different SIZE_DIFFERENT
                        (bool) if True, a file will be copied only if size are different, otherwise, it will be copied if the first file is more recent (default: True)
  -n NO_DELETION, --no_deletion NO_DELETION
                        (bool) if a file is found in the second folder and not in the first one, if will be removed unless no_deletion is True (default: False)
  -f FILTER, --filter FILTER
                        (str) None to accept every file, a string if it is a regular expression, a function for something more complex: function ``(fullname) --> True`` (every
                        file is considered in lower case), (use `*py.re.search`) (default: None)
  -fi FILTER_COPY, --filter_copy FILTER_COPY
                        (str) None to accept every file, a string if it is a regular expression, a function for something more complex: function (fullname) --> True (default:
                        None)
  -a AVOID_COPY, --avoid_copy AVOID_COPY
                        (bool) if True, just return the list of files which should be copied but does not do the copy (default: False)
  -fil FILE_DATE, --file_date FILE_DATE
                        (str) filename which contains information about when the last sync was done (default: None)
  -c COPY_1TO2, --copy_1to2 COPY_1TO2
                        (bool) only copy files from *p1* to *p2* (default: False)
  -cr CREATE_DEST, --create_dest CREATE_DEST
                        (bool) create destination directory if not exist (default: False)
Unable to parse argument due to '0':
Traceback (most recent call last):
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/site-packages/pyquickhelper/cli/cli_helper.py", line 249, in call_cli_function
    args = parser.parse_args(args=args)
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/argparse.py", line 1768, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/argparse.py", line 1800, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/argparse.py", line 2006, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/argparse.py", line 1946, in consume_optional
    take_action(action, args, option_string)
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/argparse.py", line 1874, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/argparse.py", line 1045, in __call__
    parser.exit()
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/argparse.py", line 2508, in exit
    _sys.exit(status)
SystemExit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/bin/pyq-sync", line 8, in <module>
    sys.exit(pyq_sync())
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/site-packages/pyquickhelper/cli/pyq_sync_cli.py", line 36, in pyq_sync
    call_cli_function(synchronize_folder, args=args, fLOG=fLOG,
  File "/usr/local/Caskroom/miniforge/base/envs/pyquickhelper/lib/python3.8/site-packages/pyquickhelper/cli/cli_helper.py", line 253, in call_cli_function
    fLOG("    ", " ".join(args))
TypeError: can only join an iterable