_add_common_args#
- petpal.cli.cli_preproc._add_common_args(parser: argparse.ArgumentParser) None#
Adds common arguments (’–input-img’, ‘–out-img’) to a provided ArgumentParser object.
This function modifies the passed ArgumentParser object by adding two arguments commonly used for the command line scripts. It uses the add_argument method of the ArgumentParser class. After running this function, the parser will be able to accept and parse these additional arguments from the command line when run.
Note
This function modifies the passed parser object in-place and does not return anything.
- Parameters:
parser (argparse.ArgumentParser) – The argument parser object to which the arguments are added.
- Raises:
argparse.ArgumentError – If a duplicate argument tries to be added.
- Side Effects:
Modifies the ArgumentParser object by adding new arguments.
Example
parser = argparse.ArgumentParser() _add_common_args(parser) args = parser.parse_args(['--pet', 'pet_file', '--out-dir', './', '--prefix', 'prefix']) print(args.pet) print(args.out_dir) print(args.prefix)