Merge pull request #3155 from ThomasWaldmann/maincommand-help-1.1

maincommand help 1.1
This commit is contained in:
TW 2017-10-13 01:45:19 +02:00 committed by GitHub
commit 17ce2f728a
2 changed files with 11 additions and 0 deletions

View File

@ -30,3 +30,11 @@ Common options
All Borg commands share these options:
.. include:: common-options.rst.inc
Examples
~~~~~~~~
::
# Create an archive and log: borg version, files list, return code
$ borg create --show-version --list --show-rc /path/to/repo::my-files files

View File

@ -2156,6 +2156,8 @@ class Archiver:
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 @@ class Archiver:
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__,