Skip to content

Commit

Permalink
global parser
Browse files Browse the repository at this point in the history
makes external integration with e.g.  easy
  • Loading branch information
casperdcl committed Dec 22, 2024
1 parent 4bab2f1 commit 8854bf0
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions src/markitdown/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,37 @@
from .__about__ import __version__
from ._markitdown import MarkItDown, DocumentConverterResult

parser = argparse.ArgumentParser(
description="Convert various file formats to markdown.",
prog="markitdown",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=dedent(
"""\
examples:
markitdown example.pdf
markitdown -o example.md example.pdf
cat example.pdf | markitdown > example.md"""
),
)
parser.add_argument(
"-v",
"--version",
action="version",
version=f"%(prog)s {__version__}",
help="show the version number and exit",
)
parser.add_argument(
"filename", nargs="?", help="if unspecified, defaults to stdin"
)
parser.add_argument(
"-o",
"--output",
dest="filename",
help="if unspecified, defaults to stdout",
)

def main():
parser = argparse.ArgumentParser(
description="Convert various file formats to markdown.",
prog="markitdown",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=dedent(
"""\
examples:
markitdown example.pdf
markitdown -o example.md example.pdf
cat example.pdf | markitdown > example.md"""
),
)
parser.add_argument(
"-v",
"--version",
action="version",
version=f"%(prog)s {__version__}",
help="show the version number and exit",
)
parser.add_argument(
"filename", nargs="?", help="if unspecified, defaults to stdin"
)
parser.add_argument(
"-o",
"--output",
dest="filename",
help="if unspecified, defaults to stdout",
)

def main():
args = parser.parse_args()
markitdown = MarkItDown()

Expand Down

0 comments on commit 8854bf0

Please sign in to comment.