diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-09 14:15:53 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-09 14:15:53 +0900 |
| commit | 75b15f58b778b4574e74c86c103b7e36baf4eeb3 (patch) | |
| tree | 381281bf52f940ef32f8542943b01b37b8de0855 /crates/mozart/src/commands/outdated.rs | |
| parent | f18c18cd15f180b5067069ec6f10530515715f3d (diff) | |
| download | php-mozart-75b15f58b778b4574e74c86c103b7e36baf4eeb3.tar.gz php-mozart-75b15f58b778b4574e74c86c103b7e36baf4eeb3.tar.zst php-mozart-75b15f58b778b4574e74c86c103b7e36baf4eeb3.zip | |
refactor(show): make format field non-optional with default "text"
Replace `Option<String>` with `String` + `default_value = "text"` and
derive `Default` on `ShowArgs`, eliminating local `as_deref().unwrap_or`
bindings. outdated.rs switches to `..Default::default()` for the fields
it doesn't set.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/outdated.rs')
| -rw-r--r-- | crates/mozart/src/commands/outdated.rs | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/crates/mozart/src/commands/outdated.rs b/crates/mozart/src/commands/outdated.rs index c17360d..12646f4 100644 --- a/crates/mozart/src/commands/outdated.rs +++ b/crates/mozart/src/commands/outdated.rs @@ -58,11 +58,7 @@ pub struct OutdatedArgs { pub ignore_platform_reqs: bool, } -/// `outdated` is a proxy command — it mirrors Composer's `OutdatedCommand::execute` -/// (see `composer/src/Composer/Command/OutdatedCommand.php` 68–126), which remaps -/// its options into a `show --latest [--outdated]` invocation. Keeping the logic -/// in one place means every behavioral aspect (rendering, JSON shape, --strict, -/// mutual-exclusion checks, ignore warnings, etc.) has a single source of truth. +/// `outdated` is a proxy command, forwarding to `show --latest`. pub async fn execute( args: &OutdatedArgs, cli: &super::Cli, @@ -70,18 +66,8 @@ pub async fn execute( ) -> anyhow::Result<()> { let show_args = super::show::ShowArgs { package: args.package.clone(), - version: None, - all: false, locked: args.locked, - installed: false, - platform: false, - available: false, - self_info: false, - name_only: false, - path: false, - tree: false, latest: true, - // Composer: `if (!--all) $args['--outdated'] = true;` outdated: !args.all, ignore: args.ignore.clone(), major_only: args.major_only, @@ -90,10 +76,11 @@ pub async fn execute( sort_by_age: args.sort_by_age, direct: args.direct, strict: args.strict, - format: Some(args.format.clone()), + format: args.format.clone(), no_dev: args.no_dev, ignore_platform_req: args.ignore_platform_req.clone(), ignore_platform_reqs: args.ignore_platform_reqs, + ..Default::default() }; super::show::execute(&show_args, cli, console).await |
