Skip to content

Conversation

S3lc0uth
Copy link

@S3lc0uth S3lc0uth commented Oct 2, 2025

  • Updated CLI command docstrings in cli.py:

    • Backquoted code-style terms, constants, module names, example paths, and suffixes in all command docstrings.
    • Removed redundant blank lines between list items and sentences for better readability.
  • Updated markdown generation script (generate_cli_docs.py):

Comment on lines 61 to 74
def backquote_terms(text: str) -> str:
"""
Wrap code-style terms (ALL_CAPS, example module names, file paths, angle brackets, .Name) in backticks.
"""
# Backquote ALL_CAPS terms
text = re.sub(r"\b([A-Z_]{2,})\b", r"`\1`", text)
# Backquote example modules and paths (simple heuristics)
text = re.sub(r"\b([a-zA-Z0-9_\.]+\.py)\b", r"`\1`", text)
text = re.sub(r"\b([a-zA-Z0-9_]+\.[a-zA-Z0-9_]+)\b", r"`\1`", text)
# Backquote things like :SpecificFlowName, :AnythingName
text = re.sub(r"(:[a-zA-Z0-9_]+Name\b)", r"`\1`", text)
# Backquote things in angle brackets (e.g., <APP_TARGET>)
text = re.sub(r"(<[A-Z_]+>)", r"`\1`", text)
return text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you already updated docstrings / attributes in cli.py, which add backquotes explicitly. Actually I think that is the better approach (more control, less magic, and backquotes also makes --help output clearer). Then do we still need this magic here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this approach. Please see the new commit

\b
APP_FLOW_SPECIFIER: Specifies the application and optionally the target flow.
`APP_FLOW_SPECIFIER`: Specifies the application and optionally the target flow.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the \b needs to be kept, otherwise these bulleted lines below will be rewrapped.

https://click.palletsprojects.com/en/stable/documentation/#escaping-click-s-wrapping

(or did you see otherwise when running --help?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added \b wherever required

description = "\n\n".join(description_lines) if description_lines else ""
# Collapse multiple blank lines into a single blank line
description = "\n".join(description_lines) if description_lines else ""
description = re.sub(r"\n{2,}", "\n", description)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this over strip?

e.g. if we have two paragraphs like this in docstring:

This is paragraph 1.

This is paragraph 2.

The blank line should be there in the markdown too, to make these two separate paragraphs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved this by using description = re.sub(r"\n{3,}", "\n\n", description)

Removed the backquote_terms function and its usage in formatting options and descriptions.
@georgeh0
Copy link
Member

georgeh0 commented Oct 2, 2025

Hi @S3lc0uth can you also rerun the script to update the generated md file and add to the PR?

@badmonster0
Copy link
Member

@S3lc0uth is this PR still active? thanks

@S3lc0uth
Copy link
Author

S3lc0uth commented Oct 5, 2025

@badmonster0 yes I just need to update the md file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants