mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[codex] Fix plugin marketplace help usage (#18710)
## Summary - Updates generated CLI help for plugin marketplace commands to show the full `codex plugin marketplace ...` namespace. - Adds a regression test covering the marketplace command and its `add`, `upgrade`, and `remove` help pages. ## Root Cause The marketplace parser already lived under `codex plugin marketplace`, but Clap generated usage text from the child parser's standalone command name. That made help output show stale `codex marketplace ...` instructions even though the top-level `codex marketplace` command no longer parses. ## Validation - `just fmt` - `cargo test -p codex-cli` - `./target/debug/codex plugin marketplace --help`
This commit is contained in:
committed by
GitHub
Unverified
parent
5c239ad748
commit
e18bfeec91
@@ -176,6 +176,7 @@ enum Subcommand {
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(bin_name = "codex plugin")]
|
||||
struct PluginCli {
|
||||
#[clap(flatten)]
|
||||
pub config_overrides: CliConfigOverrides,
|
||||
@@ -1773,6 +1774,30 @@ mod tests {
|
||||
assert!(matches!(cli.subcommand, Some(Subcommand::Responses(_))));
|
||||
}
|
||||
|
||||
fn help_from_args(args: &[&str]) -> String {
|
||||
let err = MultitoolCli::try_parse_from(args).expect_err("help should short-circuit");
|
||||
assert_eq!(err.kind(), clap::error::ErrorKind::DisplayHelp);
|
||||
err.to_string()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_marketplace_help_uses_plugin_namespace() {
|
||||
let help = help_from_args(&["codex", "plugin", "marketplace", "--help"]);
|
||||
assert!(
|
||||
help.contains("Usage: codex plugin marketplace [OPTIONS] <COMMAND>"),
|
||||
"{help}"
|
||||
);
|
||||
|
||||
for (subcommand, usage) in [
|
||||
("add", "Usage: codex plugin marketplace add"),
|
||||
("upgrade", "Usage: codex plugin marketplace upgrade"),
|
||||
("remove", "Usage: codex plugin marketplace remove"),
|
||||
] {
|
||||
let help = help_from_args(&["codex", "plugin", "marketplace", subcommand, "--help"]);
|
||||
assert!(help.contains(usage), "{help}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_marketplace_add_parses_under_plugin() {
|
||||
let cli =
|
||||
|
||||
@@ -13,6 +13,7 @@ use codex_core::plugins::remove_marketplace;
|
||||
use codex_utils_cli::CliConfigOverrides;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(bin_name = "codex plugin marketplace")]
|
||||
pub struct MarketplaceCli {
|
||||
#[clap(flatten)]
|
||||
pub config_overrides: CliConfigOverrides,
|
||||
@@ -29,6 +30,7 @@ enum MarketplaceSubcommand {
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(bin_name = "codex plugin marketplace add")]
|
||||
struct AddMarketplaceArgs {
|
||||
/// Marketplace source. Supports owner/repo[@ref], HTTP(S) Git URLs, SSH URLs,
|
||||
/// or local marketplace root directories.
|
||||
@@ -46,11 +48,13 @@ struct AddMarketplaceArgs {
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(bin_name = "codex plugin marketplace upgrade")]
|
||||
struct UpgradeMarketplaceArgs {
|
||||
marketplace_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(bin_name = "codex plugin marketplace remove")]
|
||||
struct RemoveMarketplaceArgs {
|
||||
/// Configured marketplace name to remove.
|
||||
marketplace_name: String,
|
||||
|
||||
Reference in New Issue
Block a user