(self, args: argparse.Namespace)
| 400 | help = "describe services and workflows in the composition" |
| 401 | |
| 402 | def run(self, args: argparse.Namespace) -> None: |
| 403 | composition = load_composition(args, munge_services=False) |
| 404 | |
| 405 | workflows = [] |
| 406 | for name, fn in composition.workflows.items(): |
| 407 | workflows.append((name, inspect.getdoc(fn) or "")) |
| 408 | workflows.sort() |
| 409 | |
| 410 | name_width = min(max(len(name) for name, _ in workflows), 16) |
| 411 | |
| 412 | if composition.description: |
| 413 | print("Description:") |
| 414 | print(composition.description) |
| 415 | print() |
| 416 | |
| 417 | print("Services:") |
| 418 | for name in sorted(composition.compose["services"]): |
| 419 | print(f" {name}") |
| 420 | |
| 421 | print() |
| 422 | print("Workflows:") |
| 423 | for name, description in workflows: |
| 424 | if len(name) <= name_width or not description: |
| 425 | print(f" {name: <{name_width}} {description}") |
| 426 | else: |
| 427 | print(f" {name}") |
| 428 | print(f" {' ' * name_width} {description}") |
| 429 | |
| 430 | print() |
| 431 | print("""For help on a specific workflow, run: |
| 432 | |
| 433 | $ ./mzcompose run WORKFLOW --help |
| 434 | """) |
| 435 | |
| 436 | |
| 437 | class DescriptionCommand(Command): |
nothing calls this directly
no test coverage detected