swansonk14 / typed-argument-parser

Typed argument parser for Python
MIT License
507 stars 40 forks source link

feat: add support for single-quoted doc #91

Closed zephvr closed 1 year ago

zephvr commented 2 years ago

This PR fulfill #84 request to support single-quoted doc

With it

# code.py
from pathlib import Path
from tap import Tap

class Args(Tap):
    db: Path
    "database file"

Args().parse_args()

gives

$ python code.py -h
usage: code.py --db DB [-h]

options:
  --db DB     (Path, required) database file
  -h, --help  show this help message and exit

Of course tell me if I need to change my MR, I'm still learning my way to contribute to open source project I like

martinjm97 commented 1 year ago

Thank you for the PR! We're merging it and then consolidating the logic in tap/utils.py to check if for starting and ending with quotes and then strips the strings appropriately.

Thanks again, Jesse and Kyle