Skip to content

Commit b1e2982

Browse files
committed
fix(models): propagate provider filter when specified before list command
Fixes bounty issue #1687 When running 'cortex models openai list', the provider argument was captured by ModelsCli.provider but ignored when the List subcommand was matched. Now the provider filter is passed through to run_list() using args.provider.or(self.provider), supporting both 'cortex models openai list' and 'cortex models list openai' orderings.
1 parent 8f839ec commit b1e2982

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cortex-cli/src/models_cmd.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ impl ModelsCli {
6262
/// Run the models command.
6363
pub async fn run(self) -> Result<()> {
6464
match self.subcommand {
65-
Some(ModelsSubcommand::List(args)) => run_list(args.provider, args.json).await,
65+
Some(ModelsSubcommand::List(args)) => {
66+
// Use args.provider if specified, otherwise fall back to self.provider
67+
// This handles both `cortex models openai list` and `cortex models list openai`
68+
let provider = args.provider.or(self.provider);
69+
let json = args.json || self.json;
70+
run_list(provider, json).await
71+
}
6672
None => {
6773
// Default: list models with optional provider filter
6874
run_list(self.provider, self.json).await

0 commit comments

Comments
 (0)