From 39410d01df6ecb42a81c4219bdbd3ff6e21b8bfd Mon Sep 17 00:00:00 2001 From: Sugato Ray Date: Wed, 18 Dec 2024 14:22:58 -0500 Subject: [PATCH] Update CLI helpdoc formatting to allow indentation in code Use `textwrap.dedent()` to allow indented cli-helpdoc in `__main__.py` file. The indentation increases readability, while `textwrap.dedent` helps maintain the same functionality without breaking code. --- src/markitdown/__main__.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/markitdown/__main__.py b/src/markitdown/__main__.py index 2d53173..9c48cd4 100644 --- a/src/markitdown/__main__.py +++ b/src/markitdown/__main__.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: MIT import sys import argparse +from textwrap import dedent from ._markitdown import MarkItDown @@ -10,24 +11,24 @@ def main(): parser = argparse.ArgumentParser( description="Convert various file formats to markdown.", formatter_class=argparse.RawDescriptionHelpFormatter, - usage=""" -SYNTAX: - - markitdown - If FILENAME is empty, markitdown reads from stdin. - -EXAMPLE: - - markitdown example.pdf - - OR - - cat example.pdf | markitdown - - OR - - markitdown < example.pdf -""".strip(), + usage=dedent(""" + SYNTAX: + + markitdown + If FILENAME is empty, markitdown reads from stdin. + + EXAMPLE: + + markitdown example.pdf + + OR + + cat example.pdf | markitdown + + OR + + markitdown < example.pdf + """).strip(), ) parser.add_argument("filename", nargs="?")