diff --git a/setup.py b/setup.py index d432bb164..a8da0bf07 100644 --- a/setup.py +++ b/setup.py @@ -220,7 +220,7 @@ def run(self): os.mkdir('docs/usage') # allows us to build docs without the C modules fully loaded during help generation from borg.archiver import Archiver - parser = Archiver(prog='borg').parser + parser = Archiver(prog='borg').build_parser() self.generate_level("", parser, Archiver) @@ -369,7 +369,7 @@ def run(self): os.makedirs('docs/man', exist_ok=True) # allows us to build docs without the C modules fully loaded during help generation from borg.archiver import Archiver - parser = Archiver(prog='borg').parser + parser = Archiver(prog='borg').build_parser() self.generate_level('', parser, Archiver) self.build_topic_pages(Archiver) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index 4898731f5..5de24d266 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -1691,7 +1691,7 @@ def preprocess_args(self, args): print(warning, file=sys.stderr) return args - def build_parser(self, prog=None): + def build_parser(self): def process_epilog(epilog): epilog = textwrap.dedent(epilog).splitlines() try: @@ -1702,7 +1702,7 @@ def process_epilog(epilog): epilog = [line for line in epilog if not line.startswith('.. man')] return '\n'.join(epilog) - common_parser = argparse.ArgumentParser(add_help=False, prog=prog) + common_parser = argparse.ArgumentParser(add_help=False, prog=self.prog) common_group = common_parser.add_argument_group('Common options') common_group.add_argument('-h', '--help', action='help', help='show this help message and exit') @@ -1743,7 +1743,7 @@ def process_epilog(epilog): action='store_true', default=False, help='treat part files like normal files (e.g. to list/extract them)') - parser = argparse.ArgumentParser(prog=prog, description='Borg - Deduplicated Backups') + parser = argparse.ArgumentParser(prog=self.prog, description='Borg - Deduplicated Backups') parser.add_argument('-V', '--version', action='version', version='%(prog)s ' + __version__, help='show version number and exit') subparsers = parser.add_subparsers(title='required arguments', metavar='') @@ -3079,7 +3079,7 @@ def parse_args(self, args=None): # We can't use argparse for "serve" since we don't want it to show up in "Available commands" if args: args = self.preprocess_args(args) - parser = self.build_parser(self.prog) + parser = self.build_parser() args = parser.parse_args(args or ['-h']) if args.func == self.do_create: # need at least 1 path but args.paths may also be populated from patterns