| 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 2 | # All rights reserved. |
| 3 | # |
| 4 | # This source code is licensed under the terms described in the LICENSE file in |
| 5 | # the root directory of this source tree. |
| 6 | |
| 7 | import argparse |
| 8 | |
| 9 | from llama_stack.cli.subcommand import Subcommand |
| 10 | |
| 11 | from .build import StackBuild |
| 12 | from .configure import StackConfigure |
| 13 | from .list_apis import StackListApis |
| 14 | from .list_providers import StackListProviders |
| 15 | from .run import StackRun |
| 16 | |
| 17 | |
| 18 | class StackParser(Subcommand): |
| 19 | def __init__(self, subparsers: argparse._SubParsersAction): |
| 20 | super().__init__() |
| 21 | self.parser = subparsers.add_parser( |
| 22 | "stack", |
| 23 | prog="llama stack", |
| 24 | description="Operations for the Llama Stack / Distributions", |
| 25 | ) |
| 26 | |
| 27 | subparsers = self.parser.add_subparsers(title="stack_subcommands") |
| 28 | |
| 29 | # Add sub-commands |
| 30 | StackBuild.create(subparsers) |
| 31 | StackConfigure.create(subparsers) |
| 32 | StackListApis.create(subparsers) |
| 33 | StackListProviders.create(subparsers) |
| 34 | StackRun.create(subparsers) |