Skip to content

Instantly share code, notes, and snippets.

@ftnext
Last active April 19, 2024 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ftnext/ab31bd23ebe5244df0ee2792af7ada43 to your computer and use it in GitHub Desktop.
Save ftnext/ab31bd23ebe5244df0ee2792af7ada43 to your computer and use it in GitHub Desktop.
# /// script
# dependencies = ["pydantic"]
# ///
import argparse
from pathlib import Path
from pydantic.dataclasses import dataclass
@dataclass
class Args:
path: Path
parser = argparse.ArgumentParser()
parser.add_argument("path")
args = parser.parse_args(namespace=Args)
print(args.path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment