From 5f88ff0b6a3dd2d5c216f0e50b7eaa14b3c318d2 Mon Sep 17 00:00:00 2001 From: Charlie Doern Date: Wed, 12 Feb 2025 09:38:25 -0500 Subject: [PATCH] fix: show proper help text (#1065) # What does this PR do? when executing a sub-command like `llama model` the improper help text, sub-commands, and flags are displayed. each command group needs to have `.set_defaults` to display this info properly before: ``` llama model usage: llama [-h] {model,stack,download,verify-download} ... Welcome to the Llama CLI options: -h, --help show this help message and exit subcommands: {model,stack,download,verify-download} ``` after: ``` llama model usage: llama model [-h] {download,list,prompt-format,describe,verify-download} ... Work with llama models options: -h, --help show this help message and exit model_subcommands: {download,list,prompt-format,describe,verify-download} ``` Signed-off-by: Charlie Doern --- llama_stack/cli/model/model.py | 2 ++ llama_stack/cli/stack/stack.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/llama_stack/cli/model/model.py b/llama_stack/cli/model/model.py index f59ba8376..02e7f216f 100644 --- a/llama_stack/cli/model/model.py +++ b/llama_stack/cli/model/model.py @@ -26,6 +26,8 @@ class ModelParser(Subcommand): description="Work with llama models", ) + self.parser.set_defaults(func=lambda args: self.parser.print_help()) + subparsers = self.parser.add_subparsers(title="model_subcommands") # Add sub-commands diff --git a/llama_stack/cli/stack/stack.py b/llama_stack/cli/stack/stack.py index 8650bd728..10e49f8c9 100644 --- a/llama_stack/cli/stack/stack.py +++ b/llama_stack/cli/stack/stack.py @@ -31,6 +31,8 @@ class StackParser(Subcommand): version=f"{version('llama-stack')}", ) + self.parser.set_defaults(func=lambda args: self.parser.print_help()) + subparsers = self.parser.add_subparsers(title="stack_subcommands") # Add sub-commands