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,15 +57,26 @@ def main():
|
|||
"--output",
|
||||
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()
|
||||
|
||||
kwargs = {}
|
||||
if args.engine:
|
||||
kwargs.update({"engine": args.engine})
|
||||
|
||||
if args.filename is None:
|
||||
markitdown = MarkItDown()
|
||||
result = markitdown.convert_stream(sys.stdin.buffer)
|
||||
_handle_output(args, result)
|
||||
else:
|
||||
markitdown = MarkItDown()
|
||||
result = markitdown.convert(args.filename)
|
||||
result = markitdown.convert(args.filename, **kwargs)
|
||||
_handle_output(args, result)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue