Merge pull request #130 from sugatoray/update_commandline_help

Update CLI helpdoc formatting to allow indentation in code
This commit is contained in:
gagb
2024-12-19 10:20:23 -08:00
committed by GitHub
2 changed files with 23 additions and 18 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
.vscode
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: MIT
import sys
import argparse
from textwrap import dedent
from ._markitdown import MarkItDown
@@ -10,24 +11,26 @@ def main():
parser = argparse.ArgumentParser(
description="Convert various file formats to markdown.",
formatter_class=argparse.RawDescriptionHelpFormatter,
usage="""
SYNTAX:
markitdown <OPTIONAL: FILENAME>
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 <OPTIONAL: FILENAME>
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="?")