1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 18:28:42 +00:00

don't crash if only a global option is given, show help, fixes #3142

(cherry picked from commit 3be328ed70)
This commit is contained in:
Thomas Waldmann 2017-10-12 05:40:52 +02:00
parent f407de07a8
commit c768999a05

View file

@ -2156,6 +2156,8 @@ def do_subcommand_help(self, parser, args):
parser.print_help()
return EXIT_SUCCESS
do_maincommand_help = do_subcommand_help
def preprocess_args(self, args):
deprecations = [
# ('--old', '--new' or None, 'Warning: "--old" has been deprecated. Use "--new" instead.'),
@ -2423,6 +2425,7 @@ def define_archive_filters_group(subparser, *, sort_by=True, first_last=True):
parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups',
add_help=False)
parser.set_defaults(func=functools.partial(self.do_maincommand_help, parser))
parser.common_options = self.CommonOptions(define_common_options,
suffix_precedence=('_maincommand', '_midcommand', '_subcommand'))
parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__,