Skip to content

Commit 8162419

Browse files
committed
Improve model run error message clarity
This applies both for when an empty string or an incorrect model name is specified. The prior had an error message already, but it was fairly vague. The latter was using the default error output from later in execution. This commit makes them consistent and more detailed, providing two suggestions.
1 parent 818e4a9 commit 8162419

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cmd/run/run.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,18 @@ func NewRunCommand() *cobra.Command {
226226
modelName = args[0]
227227
}
228228

229+
foundMatch := false
229230
for _, model := range models {
230231
if strings.EqualFold(model.FriendlyName, modelName) || strings.EqualFold(model.Name, modelName) {
231232
modelName = model.Name
233+
foundMatch = true
232234
break
233-
}
235+
}
234236
}
235237

236-
if modelName == "" {
237-
return errors.New("the specified model name is not supported")
238-
}
238+
if !foundMatch || modelName == "" {
239+
return errors.New("The specified model name is not found. Run 'gh models list' to see available models or 'gh models run' to select interactively.")
240+
}
239241

240242
initialPrompt := ""
241243
singleShot := false

0 commit comments

Comments
 (0)