Allow specifying --agent none to mean no agent

This commit is contained in:
Matt Low 2024-09-23 03:04:43 +00:00
parent a46d211e10
commit 172bfc57e1
2 changed files with 2 additions and 2 deletions

View File

@ -83,7 +83,7 @@ func validateGenerationFlags(ctx *lmcli.Context, cmd *cobra.Command) error {
if err != nil { if err != nil {
return fmt.Errorf("Error parsing --agent: %w", err) return fmt.Errorf("Error parsing --agent: %w", err)
} }
if agent != "" && !slices.Contains(ctx.GetAgents(), agent) { if agent != "" && agent != "none" && !slices.Contains(ctx.GetAgents(), agent) {
return fmt.Errorf("Unknown agent: %s", agent) return fmt.Errorf("Unknown agent: %s", agent)
} }
return nil return nil

View File

@ -86,7 +86,7 @@ func (c *Context) GetAgents() (agents []string) {
} }
func (c *Context) GetAgent(name string) *Agent { func (c *Context) GetAgent(name string) *Agent {
if name == "" { if name == "" || name == "none" {
return nil return nil
} }