diff --git a/src/markitdown/__main__.py b/src/markitdown/__main__.py index 3193ae7..b6cf963 100644 --- a/src/markitdown/__main__.py +++ b/src/markitdown/__main__.py @@ -1,33 +1,35 @@ # SPDX-FileCopyrightText: 2024-present Adam Fourney # # SPDX-License-Identifier: MIT -import sys import argparse +import sys from textwrap import dedent +from .__about__ import __version__ from ._markitdown import MarkItDown, DocumentConverterResult def main(): parser = argparse.ArgumentParser( description="Convert various file formats to markdown.", + prog="markitdown", formatter_class=argparse.RawDescriptionHelpFormatter, usage=dedent( """ - SYNTAX: - + SYNTAX: + markitdown If FILENAME is empty, markitdown reads from stdin. - + EXAMPLE: - + markitdown example.pdf - + OR - + cat example.pdf | markitdown - - OR - + + OR + markitdown < example.pdf OR to save to a file use @@ -41,6 +43,14 @@ def main(): ).strip(), ) + parser.add_argument( + "-v", + "--version", + action="version", + version=f"%(prog)s {__version__}", + help="show the version number and exit", + ) + parser.add_argument("filename", nargs="?") parser.add_argument( "-o",