Skip to content

Consider exporting argparse error type #46

@mz8i

Description

@mz8i

It might be useful to provide some kind of error classes as part of this package.
For example, I use code like this:

from argparse import ArgumentError, ArgumentParser

def file_path(x: str):
   d = Path(x)
   if d.is_dir:
      raise ArgumentError(f"{d} is a directory")
   return d

parser = ArgumentParser()
parser.add_argument('output_file', type=file_path, help="Path to output file")
parser.parse_args()

I would like to use TAP for this, so would be nice to import all the classes I need from the single package, rather than still importing error classes from argparse, or writing my own each time.
The easiest would probably be to just expose the classes from argparse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions