Skip to content

Commit

Permalink
Move docstring to build_parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Apr 25, 2024
1 parent 496a478 commit 89ea916
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions jaraco/mongodb/oplog.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ def delta_from_seconds(seconds):


def parse_args(*args, **kwargs):
return build_parser().parse_args(*args, **kwargs)


def build_parser():
"""
Parse the args for the command.
Build the argument parser.
It should be possible for one to specify '--ns', '-x', and '--rename'
multiple times:
Expand All @@ -53,14 +57,7 @@ def parse_args(*args, **kwargs):
2
>>> set(map(type, renames))
{<class 'jaraco.mongodb.oplog.RenameSpec'>}
"""
args = build_parser().parse_args(*args, **kwargs)
args.start_ts = args.start_ts or args.resume_file.read()
return args


def build_parser():
parser = argparse.ArgumentParser(add_help=False)

parser.add_argument(
Expand Down Expand Up @@ -340,7 +337,8 @@ def _load_dest(host):


def main():
args = parse_args()
args = build_parser().parse_args()
args.start_ts = args.start_ts or args.resume_file.read()
log_format = '%(asctime)s - %(levelname)s - %(message)s'
jaraco.logging.setup(args, format=log_format)

Expand Down

0 comments on commit 89ea916

Please sign in to comment.