fix: argparse CLI option ordering, fixes #268 (#290)

* fix: argparse CLI option ordering, fixes #268
* Fixed formatting.
This commit is contained in:
Werner Robitza
2025-02-09 05:50:38 +01:00
committed by GitHub
parent 7cf5e0bb23
commit 2a4f7bb6a8

View File

@@ -4,8 +4,8 @@
import argparse import argparse
import sys import sys
from textwrap import dedent from textwrap import dedent
from __about__ import __version__ from .__about__ import __version__
from _markitdown import MarkItDown, DocumentConverterResult from ._markitdown import MarkItDown, DocumentConverterResult
def main(): def main():
@@ -51,24 +51,27 @@ def main():
help="show the version number and exit", help="show the version number and exit",
) )
parser.add_argument("filename", nargs="?")
parser.add_argument( parser.add_argument(
"-o", "-o",
"--output", "--output",
help="Output file name. If not provided, output is written to stdout.", help="Output file name. If not provided, output is written to stdout.",
) )
parser.add_argument( parser.add_argument(
"-d", "-d",
"--use-docintel", "--use-docintel",
action="store_true", action="store_true",
help="Use Document Intelligence to extract text instead of offline conversion. Requires a valid Document Intelligence Endpoint.", help="Use Document Intelligence to extract text instead of offline conversion. Requires a valid Document Intelligence Endpoint.",
) )
parser.add_argument( parser.add_argument(
"-e", "-e",
"--endpoint", "--endpoint",
type=str, type=str,
help="Document Intelligence Endpoint. Required if using Document Intelligence.", help="Document Intelligence Endpoint. Required if using Document Intelligence.",
) )
parser.add_argument("filename", nargs="?")
args = parser.parse_args() args = parser.parse_args()
if args.use_docintel: if args.use_docintel: