Skip to content

[BUG] Hidden commands should not be included in typer app.py utils docs markdown output #3917

@nfrasser

Description

@nfrasser

Describe the bug

When generating a markdown documentation page for a Typer app, commands marked with hidden=True should not be included.

Steps to reproduce:

  1. Create a typer app script where one command is marked as hidden, e.g., the delete command in this example:
    import typer
    
    app = typer.Typer(help="Awesome CLI user manager.")
    
    
    @app.command()
    def create(username: str):
        """
        Create a new user with USERNAME.
        """
        pass
        
    
    @app.command(hidden=True)
    def delete(username: str):
        """
        Delete a user with USERNAME.
        
        If --force is not used, will ask for confirmation.
        """
        pass
        
    
    if __name__ == "__main__":
        app()
    Save as app.py
  2. Generate the markdown docs with command typer app.py utils docs

Expected: Only the create command details are included in the markdown output
Actual: Both the create and delete command details are included in the markdown output

The commands are correctly excluded when running the app normally with python app.py --help.

Platform

Click to expand
  • Linux
  • Tmux via iTerm

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions