Skip to content

Commit ab0f0c4

Browse files
authored
Merge pull request #4 from github/models/322-improve-error-messaging-root
Improve clarity of model run command's error message
2 parents bb2a622 + 1b69d4a commit ab0f0c4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cmd/run/run.go

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

229+
noMatchErrorMessage := "The specified model name is not found. Run 'gh models list' to see available models or 'gh models run' to select interactively."
230+
231+
if modelName == "" {
232+
return errors.New(noMatchErrorMessage)
233+
}
234+
235+
foundMatch := false
229236
for _, model := range models {
230237
if strings.EqualFold(model.FriendlyName, modelName) || strings.EqualFold(model.Name, modelName) {
231238
modelName = model.Name
239+
foundMatch = true
232240
break
233241
}
234242
}
235243

236-
if modelName == "" {
237-
return errors.New("the specified model name is not supported")
244+
if !foundMatch {
245+
return errors.New(noMatchErrorMessage)
238246
}
239247

240248
initialPrompt := ""

0 commit comments

Comments
 (0)