diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-02 15:44:32 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-02 15:44:32 +0900 |
| commit | 4361059d3bb27916179acfebb8889f1863319bb9 (patch) | |
| tree | 2e9a42fba19abe233cdb9cceb26b5909e54e95ee | |
| parent | 69b35b0c4d8cb583b389973b096f9dd2dee695c6 (diff) | |
| download | php-shirabe-4361059d3bb27916179acfebb8889f1863319bb9.tar.gz php-shirabe-4361059d3bb27916179acfebb8889f1863319bb9.tar.zst php-shirabe-4361059d3bb27916179acfebb8889f1863319bb9.zip | |
fix(command): wire the missed suggested values and correct update's packages args
Review of the suggested-values wiring against the PHP originals found:
- audit --format (Auditor::FORMATS) and --abandoned (Auditor::ABANDONEDS)
had no suggestions; only ignore-severity had been converted
- the same constant-passing shape was missed on --audit-format
(Auditor::FORMATS) in update, install, require, create-project and
remove
- update's packages argument used suggest_installed_package(false, true),
but PHP's suggestInstalledPackage(false) expands to (false, false); the
stray true came from an incorrect old TODO comment, and made platform
packages appear among the candidates
With these, every one of the 47 suggestedValues sites in the PHP command
definitions has a matching new5/new6 call.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| -rw-r--r-- | crates/shirabe/src/command/audit_command.rs | 6 | ||||
| -rw-r--r-- | crates/shirabe/src/command/create_project_command.rs | 3 | ||||
| -rw-r--r-- | crates/shirabe/src/command/install_command.rs | 3 | ||||
| -rw-r--r-- | crates/shirabe/src/command/remove_command.rs | 6 | ||||
| -rw-r--r-- | crates/shirabe/src/command/require_command.rs | 3 | ||||
| -rw-r--r-- | crates/shirabe/src/command/update_command.rs | 5 |
6 files changed, 17 insertions, 9 deletions
diff --git a/crates/shirabe/src/command/audit_command.rs b/crates/shirabe/src/command/audit_command.rs index 25ca433b..87188539 100644 --- a/crates/shirabe/src/command/audit_command.rs +++ b/crates/shirabe/src/command/audit_command.rs @@ -57,12 +57,13 @@ impl Command for AuditCommand { ) .unwrap() .into(), - InputOption::new( + InputOption::new6( "format", Some(PhpMixed::String("f".to_string())), Some(InputOption::VALUE_REQUIRED), "Output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_TABLE.to_string())), + SuggestedValues::List(Auditor::FORMATS.iter().map(|s| s.to_string()).collect()), ) .unwrap() .into(), @@ -75,12 +76,13 @@ impl Command for AuditCommand { ) .unwrap() .into(), - InputOption::new( + InputOption::new6( "abandoned", None, Some(InputOption::VALUE_REQUIRED), "Behavior on abandoned packages. Must be \"ignore\", \"report\", or \"fail\".", None, + SuggestedValues::List(Auditor::ABANDONEDS.iter().map(|s| s.to_string()).collect()), ) .unwrap() .into(), diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index 6da21f48..3410ad8b 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -9,6 +9,7 @@ use crate::config::ConfigSourceInterface; use crate::config::JsonConfigSource; use crate::console::input::InputArgument; use crate::console::input::InputOption; +use crate::console::input::SuggestedValues; use crate::dependency_resolver::operation::InstallOperation; use crate::factory::Factory; use crate::filter::platform_requirement_filter::IgnoreAllPlatformRequirementFilter; @@ -102,7 +103,7 @@ impl Command for CreateProjectCommand { InputOption::new("remove-vcs", None, Some(InputOption::VALUE_NONE), "Whether to force deletion of the vcs folder without prompting.", None).unwrap().into(), InputOption::new("no-install", None, Some(InputOption::VALUE_NONE), "Whether to skip installation of the package dependencies.", None).unwrap().into(), InputOption::new("no-audit", None, Some(InputOption::VALUE_NONE), "Whether to skip auditing of the installed package dependencies (can also be set via the COMPOSER_NO_AUDIT=1 env var).", None).unwrap().into(), - InputOption::new("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\" or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string()))).unwrap().into(), + InputOption::new6("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\" or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string())), SuggestedValues::List(Auditor::FORMATS.iter().map(|s| s.to_string()).collect())).unwrap().into(), InputOption::new("no-security-blocking", None, Some(InputOption::VALUE_NONE), "Allows installing packages with security advisories or that are abandoned (can also be set via the COMPOSER_NO_SECURITY_BLOCKING=1 env var).", None).unwrap().into(), InputOption::new("ignore-platform-req", None, Some(InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY), "Ignore a specific platform requirement (php & ext- packages).", None).unwrap().into(), InputOption::new("ignore-platform-reqs", None, Some(InputOption::VALUE_NONE), "Ignore all platform requirements (php & ext- packages).", None).unwrap().into(), diff --git a/crates/shirabe/src/command/install_command.rs b/crates/shirabe/src/command/install_command.rs index 7bac166c..fafeb363 100644 --- a/crates/shirabe/src/command/install_command.rs +++ b/crates/shirabe/src/command/install_command.rs @@ -7,6 +7,7 @@ use crate::command::CompletionTrait; use crate::command::base_command::base_command_initialize; use crate::console::input::InputArgument; use crate::console::input::InputOption; +use crate::console::input::SuggestedValues; use crate::installer::Installer; use crate::io::IOInterfaceImmutable; use crate::plugin::CommandEvent; @@ -59,7 +60,7 @@ impl Command for InstallCommand { InputOption::new("no-progress", None, Some(InputOption::VALUE_NONE), "Do not output download progress.", None).unwrap().into(), InputOption::new("no-install", None, Some(InputOption::VALUE_NONE), "Do not use, only defined here to catch misuse of the install command.", None).unwrap().into(), InputOption::new("audit", None, Some(InputOption::VALUE_NONE), "Run an audit after installation is complete.", None).unwrap().into(), - InputOption::new("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string()))).unwrap().into(), + InputOption::new6("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string())), SuggestedValues::List(Auditor::FORMATS.iter().map(|s| s.to_string()).collect())).unwrap().into(), InputOption::new("verbose", Some(PhpMixed::String("v|vv|vvv".to_string())), Some(InputOption::VALUE_NONE), "Shows more details including new commits pulled in when updating packages.", None).unwrap().into(), InputOption::new("optimize-autoloader", Some(PhpMixed::String("o".to_string())), Some(InputOption::VALUE_NONE), "Optimize autoloader during autoloader dump", None).unwrap().into(), InputOption::new("classmap-authoritative", Some(PhpMixed::String("a".to_string())), Some(InputOption::VALUE_NONE), "Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.", None).unwrap().into(), diff --git a/crates/shirabe/src/command/remove_command.rs b/crates/shirabe/src/command/remove_command.rs index 4eb4308a..7d9e7d09 100644 --- a/crates/shirabe/src/command/remove_command.rs +++ b/crates/shirabe/src/command/remove_command.rs @@ -8,6 +8,7 @@ use crate::config::ConfigSourceInterface; use crate::config::JsonConfigSource; use crate::console::input::InputArgument; use crate::console::input::InputOption; +use crate::console::input::SuggestedValues; use crate::dependency_resolver::UpdateAllowTransitiveDeps; use crate::factory::Factory; use crate::installer::Installer; @@ -87,11 +88,12 @@ impl Command for RemoveCommand { Some(InputOption::VALUE_NONE), "Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).", None).unwrap().into(), - InputOption::new("audit-format", + InputOption::new6("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", - Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string()))).unwrap().into(), + Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string())), + SuggestedValues::List(Auditor::FORMATS.iter().map(|s| s.to_string()).collect())).unwrap().into(), InputOption::new("no-security-blocking", None, Some(InputOption::VALUE_NONE), diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index d53ba9a0..5bed3d00 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -7,6 +7,7 @@ use crate::command::base_command::base_command_initialize; use crate::command::{BaseCommand, BaseCommandData}; use crate::console::input::InputArgument; use crate::console::input::InputOption; +use crate::console::input::SuggestedValues; use crate::dependency_resolver::UpdateAllowTransitiveDeps; use crate::factory::Factory; use crate::installer::Installer; @@ -121,7 +122,7 @@ impl Command for RequireCommand { InputOption::new("no-update", None, Some(InputOption::VALUE_NONE), "Disables the automatic update of the dependencies (implies --no-install).", None).unwrap().into(), InputOption::new("no-install", None, Some(InputOption::VALUE_NONE), "Skip the install step after updating the composer.lock file.", None).unwrap().into(), InputOption::new("no-audit", None, Some(InputOption::VALUE_NONE), "Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).", None).unwrap().into(), - InputOption::new("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string()))).unwrap().into(), + InputOption::new6("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string())), SuggestedValues::List(Auditor::FORMATS.iter().map(|s| s.to_string()).collect())).unwrap().into(), InputOption::new("no-security-blocking", None, Some(InputOption::VALUE_NONE), "Allows installing packages with security advisories or that are abandoned (can also be set via the COMPOSER_NO_SECURITY_BLOCKING=1 env var).", None).unwrap().into(), InputOption::new("update-no-dev", None, Some(InputOption::VALUE_NONE), "Run the dependency update with the --no-dev option.", None).unwrap().into(), InputOption::new("update-with-dependencies", Some(PhpMixed::String("w".to_string())), Some(InputOption::VALUE_NONE), "Allows inherited dependencies to be updated, except those that are root requirements (can also be set via the COMPOSER_WITH_DEPENDENCIES=1 env var).", None).unwrap().into(), diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs index d4fda900..b7cced87 100644 --- a/crates/shirabe/src/command/update_command.rs +++ b/crates/shirabe/src/command/update_command.rs @@ -8,6 +8,7 @@ use crate::command::{BaseCommand, BaseCommandData}; use crate::composer::PartialComposerHandle; use crate::console::input::InputArgument; use crate::console::input::InputOption; +use crate::console::input::SuggestedValues; use crate::dependency_resolver::request::UpdateAllowTransitiveDeps; use crate::installer::Installer; use crate::io::IOInterface; @@ -67,7 +68,7 @@ impl Command for UpdateCommand { self.set_aliases(vec!["u".to_string(), "upgrade".to_string()])?; self.set_description("Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file"); self.set_definition(&[ - InputArgument::new5("packages", Some(InputArgument::IS_ARRAY | InputArgument::OPTIONAL), "Packages that should be updated, if not provided all packages are.", None, self.suggest_installed_package(false, true)).unwrap().into(), + InputArgument::new5("packages", Some(InputArgument::IS_ARRAY | InputArgument::OPTIONAL), "Packages that should be updated, if not provided all packages are.", None, self.suggest_installed_package(false, false)).unwrap().into(), InputOption::new("with", None, Some(InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED), "Temporary version constraint to add, e.g. foo/bar:1.0.0 or foo/bar=1.0.0", None).unwrap().into(), InputOption::new("prefer-source", None, Some(InputOption::VALUE_NONE), "Forces installation from package sources when possible, including VCS information.", None).unwrap().into(), InputOption::new("prefer-dist", None, Some(InputOption::VALUE_NONE), "Forces installation from package dist (default behavior).", None).unwrap().into(), @@ -78,7 +79,7 @@ impl Command for UpdateCommand { InputOption::new("lock", None, Some(InputOption::VALUE_NONE), "Overwrites the lock file hash to suppress warning about the lock file being out of date without updating package versions. Package metadata like mirrors and URLs are updated if they changed.", None).unwrap().into(), InputOption::new("no-install", None, Some(InputOption::VALUE_NONE), "Skip the install step after updating the composer.lock file.", None).unwrap().into(), InputOption::new("no-audit", None, Some(InputOption::VALUE_NONE), "Skip the audit step after updating the composer.lock file (can also be set via the COMPOSER_NO_AUDIT=1 env var).", None).unwrap().into(), - InputOption::new("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string()))).unwrap().into(), + InputOption::new6("audit-format", None, Some(InputOption::VALUE_REQUIRED), "Audit output format. Must be \"table\", \"plain\", \"json\", or \"summary\".", Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string())), SuggestedValues::List(Auditor::FORMATS.iter().map(|s| s.to_string()).collect())).unwrap().into(), InputOption::new("no-security-blocking", None, Some(InputOption::VALUE_NONE), "Allows installing packages with security advisories or that are abandoned (can also be set via the COMPOSER_NO_SECURITY_BLOCKING=1 env var).", None).unwrap().into(), InputOption::new("no-autoloader", None, Some(InputOption::VALUE_NONE), "Skips autoloader generation", None).unwrap().into(), InputOption::new("no-suggest", None, Some(InputOption::VALUE_NONE), "DEPRECATED: This flag does not exist anymore.", None).unwrap().into(), |
