update: cli options added for engine selection
This commit is contained in:
parent
f07ea3e09b
commit
a1766c5981
1 changed files with 12 additions and 1 deletions
|
|
@ -57,7 +57,18 @@ def main():
|
||||||
"--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.",
|
||||||
)
|
)
|
||||||
|
# adding CLI option for extra parameters for PdfConverter
|
||||||
|
parser.add_argument(
|
||||||
|
"-e",
|
||||||
|
"--engine",
|
||||||
|
help="Engine name for converters. If not provided will use default.",
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
kwargs = {}
|
||||||
|
if args.engine:
|
||||||
|
kwargs.update({"engine": args.engine})
|
||||||
|
|
||||||
if args.filename is None:
|
if args.filename is None:
|
||||||
markitdown = MarkItDown()
|
markitdown = MarkItDown()
|
||||||
|
|
@ -65,7 +76,7 @@ def main():
|
||||||
_handle_output(args, result)
|
_handle_output(args, result)
|
||||||
else:
|
else:
|
||||||
markitdown = MarkItDown()
|
markitdown = MarkItDown()
|
||||||
result = markitdown.convert(args.filename)
|
result = markitdown.convert(args.filename, **kwargs)
|
||||||
_handle_output(args, result)
|
_handle_output(args, result)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue