pydantic-argparse icon indicating copy to clipboard operation
pydantic-argparse copied to clipboard

Metavar support

Open cody-mar10 opened this issue 1 year ago • 0 comments

Hi great project! I was wondering if it is possible to implement something similar to the argparse packages metavar argument. I strongly prefer my arguments to specify what type should be input, and I would think this is doable since the pydantic backend is already keeping track of types.

Envision something like this:

from pydantic import BaseModel, Field, FilePath

class Args
    intarg: int = Field(..., description="an integer")
    file: FilePath = Field(..., description="a file")

then at cli:

./example_program.py --help

--intarg INT:    an integer
--file FilePath: a file

cody-mar10 avatar Jul 04 '23 15:07 cody-mar10