diff options
Diffstat (limited to 'crates/shirabe/src/command')
| -rw-r--r-- | crates/shirabe/src/command/exec_command.rs | 4 | ||||
| -rw-r--r-- | crates/shirabe/src/command/init_command.rs | 13 | ||||
| -rw-r--r-- | crates/shirabe/src/command/package_discovery_trait.rs | 47 | ||||
| -rw-r--r-- | crates/shirabe/src/command/remove_command.rs | 44 | ||||
| -rw-r--r-- | crates/shirabe/src/command/require_command.rs | 54 | ||||
| -rw-r--r-- | crates/shirabe/src/command/update_command.rs | 4 |
6 files changed, 73 insertions, 93 deletions
diff --git a/crates/shirabe/src/command/exec_command.rs b/crates/shirabe/src/command/exec_command.rs index caa9808..db91012 100644 --- a/crates/shirabe/src/command/exec_command.rs +++ b/crates/shirabe/src/command/exec_command.rs @@ -90,11 +90,11 @@ impl Command for ExecCommand { InputArgument::new("binary", Some(InputArgument::OPTIONAL), "The binary to run, e.g. phpunit", - None,).unwrap().into(), + None).unwrap().into(), InputArgument::new("args", Some(InputArgument::IS_ARRAY | InputArgument::OPTIONAL), "Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments", - None,).unwrap().into(), + None).unwrap().into(), ]); self.set_help( "Executes a vendored binary/script.\n\n\ diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index ec9ede4..d98793a 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -888,7 +888,7 @@ impl Command for InitCommand { return Err(InvalidArgumentException { message: format!( "The src folder name \"{}\" is invalid. Please add a relative path with tailing forward slash. [A-Za-z0-9_-/]+/", - PhpMixed::String(value_or_default.clone()), + value_or_default.clone(), ), code: 0, } @@ -1049,10 +1049,7 @@ impl InitCommand { return false; } - let pattern = format!( - "{{^/?{}(/\\*?)?$}}", - PhpMixed::String(preg_quote(vendor, None)), - ); + let pattern = format!("{{^/?{}(/\\*?)?$}}", preg_quote(vendor, None)); let lines = file(ignore_file, FILE_IGNORE_NEW_LINES).unwrap_or_default(); for line in &lines { @@ -1229,11 +1226,7 @@ impl InitCommand { } if let (Some(name), Some(email)) = (author_name, author_email) { - return Some(format!( - "{} <{}>", - PhpMixed::String(name), - PhpMixed::String(email), - )); + return Some(format!("{} <{}>", name, email)); } None diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index 943eeaf..bce7e9a 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -188,10 +188,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { io.write_error3( &format!( "Using version <info>{}</info> for <info>{}</info>", - PhpMixed::String(version), - PhpMixed::String( - requirement.get("name").cloned().unwrap_or_default(), - ), + version, + requirement.get("name").cloned().unwrap_or_default(), ), true, io_interface::NORMAL, @@ -295,23 +293,20 @@ pub trait PackageDiscoveryTrait: BaseCommand { if let Some(ai) = &found_package.abandoned { let replacement = match ai { crate::repository::AbandonedInfo::Replacement(r) => { - format!("Use {} instead", PhpMixed::String(r.clone())) + format!("Use {} instead", r.clone()) } crate::repository::AbandonedInfo::Abandoned => { "No replacement was suggested".to_string() } }; - abandoned = format!( - "<warning>Abandoned. {}.</warning>", - PhpMixed::String(replacement), - ); + abandoned = format!("<warning>Abandoned. {}.</warning>", replacement); } choices.push(format!( " <info>{:>5}</info> {} {}", - PhpMixed::String(format!("[{}]", position)), - PhpMixed::String(found_package.name.clone()), - PhpMixed::String(abandoned), + format!("[{}]", position), + found_package.name.clone(), + abandoned, )); } @@ -319,8 +314,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { io.write_error3( &format!( "Found <info>{}</info> packages matching <info>{}</info>", - PhpMixed::Int(matches.len() as i64), - PhpMixed::String(package.clone()), + matches.len() as i64, + package.clone(), ), true, io_interface::NORMAL, @@ -432,8 +427,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { io.write_error3( &format!( "Using version <info>{}</info> for <info>{}</info>", - PhpMixed::String(c.clone()), - PhpMixed::String(package.clone()), + c.clone(), + package.clone(), ), true, io_interface::NORMAL, @@ -563,7 +558,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Package {} has requirements incompatible with your PHP version, PHP extensions and Composer version{}", - PhpMixed::String(name.to_string()), + name.to_string(), self.get_platform_exception_details( candidate.clone(), platform_repo, @@ -617,8 +612,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find a version of package {} matching your minimum-stability ({}). Require it with an explicit version constraint allowing its desired stability.", - PhpMixed::String(name.to_string()), - PhpMixed::String(effective_minimum_stability.clone()), + name.to_string(), + effective_minimum_stability.clone(), ), code: 0, } @@ -659,12 +654,12 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find package {} in any version matching your PHP version, PHP extensions and Composer version{}{}", - PhpMixed::String(name.to_string()), + name.to_string(), self.get_platform_exception_details( candidate.clone(), platform_repo, )?, - PhpMixed::String(additional), + additional, ), code: 0, } @@ -688,7 +683,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find package {}. It was however found via repository search, which indicates a consistency issue with the repository.", - PhpMixed::String(name.to_string()), + name.to_string(), ), code: 0, } @@ -725,13 +720,13 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find package {}.\n\nDid you mean {}?\n {}", - PhpMixed::String(name.to_string()), + name.to_string(), if similar.len() > 1 { "one of these" } else { "this" }, - PhpMixed::String(implode("\n ", &similar)), + implode("\n ", &similar), ), code: 0, } @@ -741,8 +736,8 @@ pub trait PackageDiscoveryTrait: BaseCommand { return Err(InvalidArgumentException { message: format!( "Could not find a matching version of package {}. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability ({}).", - PhpMixed::String(name.to_string()), - PhpMixed::String(effective_minimum_stability), + name.to_string(), + effective_minimum_stability, ), code: 0, } diff --git a/crates/shirabe/src/command/remove_command.rs b/crates/shirabe/src/command/remove_command.rs index 0cac581..d880ca0 100644 --- a/crates/shirabe/src/command/remove_command.rs +++ b/crates/shirabe/src/command/remove_command.rs @@ -67,112 +67,112 @@ impl Command for RemoveCommand { InputArgument::new("packages", Some(InputArgument::IS_ARRAY), "Packages that should be removed.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("dev", None, Some(InputOption::VALUE_NONE), "Removes a package from the require-dev section.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("dry-run", None, Some(InputOption::VALUE_NONE), "Outputs the operations but will not execute anything (implicitly enables --verbose).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("no-progress", None, Some(InputOption::VALUE_NONE), "Do not output download progress.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("no-update", None, Some(InputOption::VALUE_NONE), "Disables the automatic update of the dependencies (implies --no-install).", - None,).unwrap().into(), + 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(), + 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(), + 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(), + Some(PhpMixed::String(Auditor::FORMAT_SUMMARY.to_string()))).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(), + 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(), + None).unwrap().into(), InputOption::new("update-with-dependencies", Some(PhpMixed::String("w".to_string())), Some(InputOption::VALUE_NONE), "Allows inherited dependencies to be updated with explicit dependencies (can also be set via the COMPOSER_WITH_DEPENDENCIES=1 env var). (Deprecated, is now default behavior)", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("update-with-all-dependencies", Some(PhpMixed::String("W".to_string())), Some(InputOption::VALUE_NONE), "Allows all inherited dependencies to be updated, including those that are root requirements (can also be set via the COMPOSER_WITH_ALL_DEPENDENCIES=1 env var).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("with-all-dependencies", None, Some(InputOption::VALUE_NONE), "Alias for --update-with-all-dependencies", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("no-update-with-dependencies", None, Some(InputOption::VALUE_NONE), "Does not allow inherited dependencies to be updated with explicit dependencies.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("minimal-changes", Some(PhpMixed::String("m".to_string())), Some(InputOption::VALUE_NONE), "During an update with -w/-W, only perform absolutely necessary changes to transitive dependencies (can also be set via the COMPOSER_MINIMAL_CHANGES=1 env var).", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("unused", None, Some(InputOption::VALUE_NONE), "Remove all packages which are locked but not required by any other package.", - None,).unwrap().into(), + 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(), + None).unwrap().into(), InputOption::new("ignore-platform-reqs", None, Some(InputOption::VALUE_NONE), "Ignore all platform requirements (php & ext- packages).", - None,).unwrap().into(), + 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(), + 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(), + None).unwrap().into(), InputOption::new("apcu-autoloader", None, Some(InputOption::VALUE_NONE), "Use APCu to cache found/not-found classes.", - None,).unwrap().into(), + None).unwrap().into(), InputOption::new("apcu-autoloader-prefix", None, Some(InputOption::VALUE_REQUIRED), "Use a custom prefix for the APCu autoloader cache. Implicitly enables --apcu-autoloader", - None,).unwrap().into(), + None).unwrap().into(), ]); self.set_help( "The <info>remove</info> command removes a package from the current\n\ diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index b1dfd4a..4bed4df 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -463,7 +463,7 @@ impl Command for RequireCommand { if strtolower(package) == composer.get_package().get_name() { let msg = format!( "<error>Root package '{}' cannot require itself in its composer.json</error>", - PhpMixed::String(package.clone()), + package.clone(), ); self.get_io().write_error3(&msg, true, io_interface::NORMAL); @@ -481,17 +481,15 @@ impl Command for RequireCommand { for package in &inconsistent_require_keys { let warn_msg = format!( "{} is currently present in the {} key and you ran the command {} the --dev flag, which will move it to the {} key.", - PhpMixed::String(package.clone()), - PhpMixed::String(remove_key.to_string()), - PhpMixed::String( - if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) { - "with" - } else { - "without" - } - .to_string(), - ), - PhpMixed::String(require_key.to_string()), + package.clone(), + remove_key.to_string(), + if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) { + "with" + } else { + "without" + } + .to_string(), + require_key.to_string(), ); self.get_io().warning(&warn_msg, &[]); } @@ -499,26 +497,22 @@ impl Command for RequireCommand { if self.get_io().is_interactive() { let q1 = format!( "<info>Do you want to move {}?</info> [<comment>no</comment>]? ", - PhpMixed::String( - if (inconsistent_require_keys.len() as i64) > 1 { - "these requirements" - } else { - "this requirement" - } - .to_string(), - ), + if (inconsistent_require_keys.len() as i64) > 1 { + "these requirements" + } else { + "this requirement" + } + .to_string(), ); if !self.get_io().ask_confirmation(q1, false) { let q2 = format!( "<info>Do you want to re-run the command {} --dev?</info> [<comment>yes</comment>]? ", - PhpMixed::String( - if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) { - "without" - } else { - "with" - } - .to_string(), - ), + if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) { + "without" + } else { + "with" + } + .to_string(), ); if !self.get_io().ask_confirmation(q2, true) { return Ok(0); @@ -1122,8 +1116,8 @@ impl RequireCommand { self.get_io().write_error3( &format!( "Using version <info>{}</info> for <info>{}</info>", - PhpMixed::String(requirements.get(package_name).cloned().unwrap_or_default(),), - PhpMixed::String(package_name.clone()), + requirements.get(package_name).cloned().unwrap_or_default(), + package_name.clone(), ), true, io_interface::NORMAL, diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs index 9073658..1903dec 100644 --- a/crates/shirabe/src/command/update_command.rs +++ b/crates/shirabe/src/command/update_command.rs @@ -707,9 +707,7 @@ impl UpdateCommand { if io.ask_confirmation( format!( "Would you like to continue and update the above package{} [<comment>yes</comment>]? ", - PhpMixed::String( - if 1 == packages.len() { "" } else { "s" }.to_string(), - ), + if 1 == packages.len() { "" } else { "s" }.to_string(), ), true, ) { |
