Skip to content

Commit

Permalink
chore: init the emitter when generating docs
Browse files Browse the repository at this point in the history
Initialize the Emitter because the command_groups() call can now emit
messages.
  • Loading branch information
tigarmo committed Nov 25, 2024
1 parent e85bab3 commit 4a5df70
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/docs/gen_cli_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pathlib
import sys

import craft_cli
from craft_cli.dispatcher import Dispatcher, _CustomArgumentParser

this_dir = pathlib.Path(os.path.split(__file__)[0])
Expand Down Expand Up @@ -71,6 +72,12 @@ def main(docs_dir):
if not commands_ref_dir.exists():
commands_ref_dir.mkdir()

craft_cli.emit.init(
mode=craft_cli.EmitterMode.BRIEF,
appname="rockcraft-docs",
greeting=f"Starting doc generation for Rockcraft.",
)

# Create a dispatcher like Rockcraft does to get access to the same options.
app = cli._create_app()
command_groups = app.command_groups
Expand Down

0 comments on commit 4a5df70

Please sign in to comment.