diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-22 17:53:13 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-22 17:53:13 +0900 |
| commit | ec5f3292ac324789298c3a12972f8f78b688ca24 (patch) | |
| tree | 44580ee521df4b0416fcafa9089695c5bc550270 /crates/shirabe | |
| parent | 7286ee29637dbc694f769b618259eb9f75bab0fa (diff) | |
| download | php-shirabe-ec5f3292ac324789298c3a12972f8f78b688ca24.tar.gz php-shirabe-ec5f3292ac324789298c3a12972f8f78b688ca24.tar.zst php-shirabe-ec5f3292ac324789298c3a12972f8f78b688ca24.zip | |
feat(cli): tell the user to run `shirabe`, not `composer`
Messages that instruct the user to run a command named the Composer
binary. Shirabe ships as its own binary, so the hints now name it.
File names (composer.json, composer.lock), the "composer" repository
type and prose about Composer itself are untouched. The installer and
functional integration fixtures live in the Composer submodule and
cannot be edited, so their expected output is normalized on load.
Diffstat (limited to 'crates/shirabe')
39 files changed, 120 insertions, 95 deletions
diff --git a/crates/shirabe/src/advisory/auditor.rs b/crates/shirabe/src/advisory/auditor.rs index fb4b105d..5c20ec67 100644 --- a/crates/shirabe/src/advisory/auditor.rs +++ b/crates/shirabe/src/advisory/auditor.rs @@ -222,7 +222,7 @@ impl Auditor { } if format == Self::FORMAT_SUMMARY { - io.write_error("Run \"composer audit\" for a full list of advisories."); + io.write_error("Run \"shirabe audit\" for a full list of advisories."); } } else { io.write_error("<info>No security vulnerability advisories found.</info>"); diff --git a/crates/shirabe/src/command/base_dependency_command.rs b/crates/shirabe/src/command/base_dependency_command.rs index 6dc049ff..4cb60308 100644 --- a/crates/shirabe/src/command/base_dependency_command.rs +++ b/crates/shirabe/src/command/base_dependency_command.rs @@ -89,7 +89,7 @@ pub trait BaseDependencyCommand: BaseCommand { && (!root_pkg.get_requires().is_empty() || !root_pkg.get_dev_requires().is_empty()) { output.borrow().writeln( - &["<warning>No dependencies installed. Try running composer install or update, or use --locked.</warning>".to_string()], + &["<warning>No dependencies installed. Try running shirabe install or update, or use --locked.</warning>".to_string()], shirabe_symfony_console::output::OUTPUT_NORMAL, ); @@ -214,7 +214,7 @@ pub trait BaseDependencyCommand: BaseCommand { } Some(matched) if inverted => { self.get_io().write(&format!( - "<comment>Package \"{}\" {} is already installed! To find out why, run `composer why {}`</comment>", + "<comment>Package \"{}\" {} is already installed! To find out why, run `shirabe why {}`</comment>", needle, matched.get_pretty_version(), needle @@ -320,7 +320,7 @@ pub trait BaseDependencyCommand: BaseCommand { } self.get_io().write_error(&format!( - "Not finding what you were looking for? Try calling `composer {} \"{}:{}\" --dry-run` to get another view on the problem.", + "Not finding what you were looking for? Try calling `shirabe {} \"{}:{}\" --dry-run` to get another view on the problem.", composer_command, needle, text_constraint )); } diff --git a/crates/shirabe/src/command/bump_command.rs b/crates/shirabe/src/command/bump_command.rs index 71ee2ffe..e10f7b15 100644 --- a/crates/shirabe/src/command/bump_command.rs +++ b/crates/shirabe/src/command/bump_command.rs @@ -149,7 +149,7 @@ impl BumpCommand { .is_some_and(|m| m.contains_key("type")) { io.write_error3( - "<warning>If your package is not a library, you can explicitly specify the \"type\" by using \"composer config type project\".</warning>", + "<warning>If your package is not a library, you can explicitly specify the \"type\" by using \"shirabe config type project\".</warning>", true, io_interface::NORMAL, ); diff --git a/crates/shirabe/src/command/config_command.rs b/crates/shirabe/src/command/config_command.rs index 90f2d7c0..53e1fe7c 100644 --- a/crates/shirabe/src/command/config_command.rs +++ b/crates/shirabe/src/command/config_command.rs @@ -995,7 +995,7 @@ impl Command for ConfigCommand { || multi_props.contains_key(&setting_key) || strpos(&setting_key, "extra.") == Some(0)) { - return Err(InvalidArgumentException::new(format!("The {} property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json", setting_key)) + return Err(InvalidArgumentException::new(format!("The {} property can not be set in the global config.json file. Use `shirabe global config` to apply changes to the global composer.json", setting_key)) .into()); } if input.borrow().get_option("unset")?.as_bool() == Some(true) diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index e2161aa3..a2b44713 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -315,7 +315,7 @@ impl CreateProjectCommand { if e.is_instanceof::<PluginBlockedException>() { io.write_error("<error>Hint: To allow running the config command recommended below before dependencies are installed, run create-project with --no-install.</error>"); io.write_error(&format!( - "<error>You can then cd into {}, configure allow-plugins, and finally run a composer install to complete the process.</error>", + "<error>You can then cd into {}, configure allow-plugins, and finally run a shirabe install to complete the process.</error>", getcwd().unwrap_or_default() )); } diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs index 0390cefb..d0448507 100644 --- a/crates/shirabe/src/command/diagnose_command.rs +++ b/crates/shirabe/src/command/diagnose_command.rs @@ -434,7 +434,7 @@ impl DiagnoseCommand { && te.get_code() == 401 { return Ok(CheckResult::Message(format!( - "<comment>The oauth token for {} seems invalid, run \"composer config --global --unset github-oauth.{}\" to remove it</comment>", + "<comment>The oauth token for {} seems invalid, run \"shirabe config --global --unset github-oauth.{}\" to remove it</comment>", domain, domain ))); } @@ -559,7 +559,7 @@ impl DiagnoseCommand { if !errors.is_empty() { errors.push( - "<error>Run composer self-update --update-keys to set them up</error>".to_string(), + "<error>Run shirabe self-update --update-keys to set them up</error>".to_string(), ); } @@ -610,7 +610,7 @@ impl DiagnoseCommand { .to_string(); if composer::VERSION != latest_version && composer::VERSION != "@package_version@" { return Ok(CheckResult::Message(format!( - "<comment>You are not running the latest {} version, run `composer self-update` to update ({} => {})</comment>", + "<comment>You are not running the latest {} version, run `shirabe self-update` to update ({} => {})</comment>", versions_util.get_channel()?, composer::VERSION, latest_version @@ -1489,7 +1489,7 @@ impl Command for DiagnoseCommand { Err(e) => { if let Some(te) = e.catch::<TransportException>() { if te.get_code() == 401 { - self.output_result(CheckResult::Message("<comment>The oauth token for github.com seems invalid, run \"composer config --global --unset github-oauth.github.com\" to remove it</comment>".to_string())); + self.output_result(CheckResult::Message("<comment>The oauth token for github.com seems invalid, run \"shirabe config --global --unset github-oauth.github.com\" to remove it</comment>".to_string())); } else { self.output_result(CheckResult::Message(format!( "<error>[{}] {}</error>", diff --git a/crates/shirabe/src/command/dump_autoload_command.rs b/crates/shirabe/src/command/dump_autoload_command.rs index 87acd74f..2e2b6289 100644 --- a/crates/shirabe/src/command/dump_autoload_command.rs +++ b/crates/shirabe/src/command/dump_autoload_command.rs @@ -98,7 +98,7 @@ impl Command for DumpAutoloadCommand { .get_install_path(local_pkg); if install_path.as_deref().is_some_and(|p| !file_exists(p)) { missing_dependencies = true; - self.get_io().write("<warning>Not all dependencies are installed. Make sure to run a \"composer install\" to install missing dependencies</warning>"); + self.get_io().write("<warning>Not all dependencies are installed. Make sure to run a \"shirabe install\" to install missing dependencies</warning>"); break; } } diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs index 9399c2a7..8d892bd3 100644 --- a/crates/shirabe/src/command/init_command.rs +++ b/crates/shirabe/src/command/init_command.rs @@ -275,7 +275,7 @@ impl InitCommand { if result.is_err() { self.get_io().borrow().write_error( - "Could not update dependencies. Run `composer update` to see more information.", + "Could not update dependencies. Run `shirabe update` to see more information.", ); } } diff --git a/crates/shirabe/src/command/install_command.rs b/crates/shirabe/src/command/install_command.rs index 1431fb57..7c8ce7af 100644 --- a/crates/shirabe/src/command/install_command.rs +++ b/crates/shirabe/src/command/install_command.rs @@ -71,7 +71,7 @@ impl Command for InstallCommand { 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(), 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(), - InputArgument::new("packages", Some(InputArgument::IS_ARRAY | InputArgument::OPTIONAL), "Should not be provided, use composer require instead to add a given package to composer.json.", None).unwrap().into(), + InputArgument::new("packages", Some(InputArgument::IS_ARRAY | InputArgument::OPTIONAL), "Should not be provided, use shirabe require instead to add a given package to composer.json.", None).unwrap().into(), ]); self.set_help( "The <info>install</info> command reads the composer.lock file from\n\ @@ -107,7 +107,7 @@ impl Command for InstallCommand { let args_vec: Vec<String> = args.as_array().map(<[String]>::to_vec).unwrap_or_default(); if !args_vec.is_empty() { io.write_error(&format!( - "<error>Invalid argument {}. Use \"composer require {}\" instead to add packages to your composer.json.</error>", + "<error>Invalid argument {}. Use \"shirabe require {}\" instead to add packages to your composer.json.</error>", args_vec.join(" "), args_vec.join(" ") )); @@ -120,7 +120,7 @@ impl Command for InstallCommand { .as_bool() .unwrap_or(false) { - io.write_error("<error>Invalid option \"--no-install\". Use \"composer update --no-install\" instead if you are trying to update the composer.lock file.</error>"); + io.write_error("<error>Invalid option \"--no-install\". Use \"shirabe update --no-install\" instead if you are trying to update the composer.lock file.</error>"); return Ok(1); } diff --git a/crates/shirabe/src/command/outdated_command.rs b/crates/shirabe/src/command/outdated_command.rs index b32fccdf..ee910d5a 100644 --- a/crates/shirabe/src/command/outdated_command.rs +++ b/crates/shirabe/src/command/outdated_command.rs @@ -63,7 +63,7 @@ impl Command for OutdatedCommand { InputOption::new("ignore-platform-reqs", None, Some(InputOption::VALUE_NONE), "Ignore all platform requirements (php & ext- packages). Use with the --outdated option", None).unwrap().into(), ]); self.set_help( - "The outdated command is just a proxy for `composer show -l`\n\n\ + "The outdated command is just a proxy for `shirabe show -l`\n\n\ The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:\n\n\ - <info>green</info> (=): Dependency is in the latest version and is up to date.\n\ - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards\n \ diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index b743b5c1..4a915fbe 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -784,7 +784,7 @@ pub trait PackageDiscoveryTrait: BaseCommand { None => { if platform_repo.is_platform_package_disabled(link.get_target()) { details.push(format!( - "{} {} requires {} {} but it is disabled by your platform config. Enable it again with \"composer config platform.{} --unset\".", + "{} {} requires {} {} but it is disabled by your platform config. Enable it again with \"shirabe config platform.{} --unset\".", candidate.get_pretty_name(), candidate.get_pretty_version(), link.get_target(), diff --git a/crates/shirabe/src/command/remove_command.rs b/crates/shirabe/src/command/remove_command.rs index e50999bb..1f6f25d0 100644 --- a/crates/shirabe/src/command/remove_command.rs +++ b/crates/shirabe/src/command/remove_command.rs @@ -637,7 +637,7 @@ impl Command for RemoveCommand { } io.write_error(&format!( - "<info>Running composer update {}{}</info>", + "<info>Running shirabe update {}{}</info>", packages.join(" "), flags )); @@ -695,7 +695,7 @@ impl Command for RemoveCommand { .is_empty() { io.write_error(&format!( - "<error>Removal failed, {} is still present, it may be required by another package. See `composer why {}`.</error>", + "<error>Removal failed, {} is still present, it may be required by another package. See `shirabe why {}`.</error>", package, package )); return Ok(2); diff --git a/crates/shirabe/src/command/repository_command.rs b/crates/shirabe/src/command/repository_command.rs index 4cf0c981..8c92b05d 100644 --- a/crates/shirabe/src/command/repository_command.rs +++ b/crates/shirabe/src/command/repository_command.rs @@ -295,17 +295,17 @@ impl Command for RepositoryCommand { self.set_help( "This command lets you manage repositories in your composer.json.\n\n\ Examples:\n \ - composer repo list\n \ - composer repo add foo vcs https://github.com/acme/foo\n \ - composer repo add bar composer https://repo.packagist.com/bar\n \ - composer repo add zips '{\"type\":\"artifact\",\"url\":\"/path/to/dir/with/zips\"}'\n \ - composer repo add baz vcs https://example.org --before foo\n \ - composer repo add qux vcs https://example.org --after bar\n \ - composer repo remove foo\n \ - composer repo set-url foo https://git.example.org/acme/foo\n \ - composer repo get-url foo\n \ - composer repo disable packagist.org\n \ - composer repo enable packagist.org\n\n\ + shirabe repo list\n \ + shirabe repo add foo vcs https://github.com/acme/foo\n \ + shirabe repo add bar composer https://repo.packagist.com/bar\n \ + shirabe repo add zips '{\"type\":\"artifact\",\"url\":\"/path/to/dir/with/zips\"}'\n \ + shirabe repo add baz vcs https://example.org --before foo\n \ + shirabe repo add qux vcs https://example.org --after bar\n \ + shirabe repo remove foo\n \ + shirabe repo set-url foo https://git.example.org/acme/foo\n \ + shirabe repo get-url foo\n \ + shirabe repo disable packagist.org\n \ + shirabe repo enable packagist.org\n\n\ Use --global/-g to alter the global config.json instead.\n\ Use --file to alter a specific file.", ); @@ -360,7 +360,7 @@ impl Command for RepositoryCommand { } "add" => { if name.is_none() { - return Err(RuntimeException::new("You must pass a repository name. Example: composer repo add foo vcs https://example.org".to_string()).into()); + return Err(RuntimeException::new("You must pass a repository name. Example: shirabe repo add foo vcs https://example.org".to_string()).into()); } if arg1.is_none() { return Err(RuntimeException::new( @@ -373,7 +373,7 @@ impl Command for RepositoryCommand { JsonFile::parse_json(Some(arg1_str), None)? } else { if arg2.is_none() { - return Err(RuntimeException::new("You must pass the type and a url. Example: composer repo add foo vcs https://example.org".to_string()).into()); + return Err(RuntimeException::new("You must pass the type and a url. Example: shirabe repo add foo vcs https://example.org".to_string()).into()); } let mut m = IndexMap::new(); m.insert("type".to_string(), PhpMixed::String(arg1_str.to_string())); @@ -458,7 +458,7 @@ impl Command for RepositoryCommand { "set-url" | "seturl" => { if name.is_none() || arg1.is_none() { return Err(RuntimeException::new( - "Usage: composer repo set-url <name> <new-url>".to_string(), + "Usage: shirabe repo set-url <name> <new-url>".to_string(), ) .into()); } @@ -472,7 +472,7 @@ impl Command for RepositoryCommand { "get-url" | "geturl" => { if name.is_none() { return Err(RuntimeException::new( - "Usage: composer repo get-url <name>".to_string(), + "Usage: shirabe repo get-url <name>".to_string(), ) .into()); } @@ -517,7 +517,7 @@ impl Command for RepositoryCommand { "disable" => { if name.is_none() { return Err(RuntimeException::new( - "Usage: composer repo disable packagist.org".to_string(), + "Usage: shirabe repo disable packagist.org".to_string(), ) .into()); } @@ -540,7 +540,7 @@ impl Command for RepositoryCommand { "enable" => { if name.is_none() { return Err(RuntimeException::new( - "Usage: composer repo enable packagist.org".to_string(), + "Usage: shirabe repo enable packagist.org".to_string(), ) .into()); } diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index 197adfd6..4f90a532 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -337,7 +337,7 @@ impl RequireCommand { io.write_error3( &format!( - "<info>Running composer update {}{}</info>", + "<info>Running shirabe update {}{}</info>", implode( " ", &array_keys(requirements) @@ -453,7 +453,7 @@ impl RequireCommand { )? { if !req.contains_key("version") { io.write_error3(&format!( - "You can also try re-running composer require with an explicit version constraint, e.g. \"composer require {}:*\" to figure out if any version is installable, or \"composer require {}:^2.1\" if you know which you need.", + "You can also try re-running shirabe require with an explicit version constraint, e.g. \"shirabe require {}:*\" to figure out if any version is installable, or \"shirabe require {}:^2.1\" if you know which you need.", req.get("name").cloned().unwrap_or_default(), req.get("name").cloned().unwrap_or_default(), ), true, io_interface::NORMAL); @@ -891,7 +891,7 @@ impl Command for RequireCommand { self.get_io().write_error3("<error>The \"--fixed\" option is only allowed for packages with a \"project\" type or for dev dependencies to prevent possible misuses.</error>", true, io_interface::NORMAL); if config.get("type").is_none() { - self.get_io().write_error3("<error>If your package is not a library, you can explicitly specify the \"type\" by using \"composer config type project\".</error>", true, io_interface::NORMAL); + self.get_io().write_error3("<error>If your package is not a library, you can explicitly specify the \"type\" by using \"shirabe config type project\".</error>", true, io_interface::NORMAL); } return Ok(1); diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs index 090678eb..f1123e14 100644 --- a/crates/shirabe/src/command/show_command.rs +++ b/crates/shirabe/src/command/show_command.rs @@ -1830,7 +1830,7 @@ impl Command for ShowCommand { { // Borrow is local; release composer_local borrow first. let _ = root_pkg; - self.get_io().write_error("<warning>No dependencies installed. Try running composer install or update.</warning>"); + self.get_io().write_error("<warning>No dependencies installed. Try running shirabe install or update.</warning>"); } } } diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs index 09809eb2..1ae7cb67 100644 --- a/crates/shirabe/src/command/update_command.rs +++ b/crates/shirabe/src/command/update_command.rs @@ -423,7 +423,7 @@ impl Command for UpdateCommand { io_interface::NORMAL, ); io.write(&format!( - "<info>Run `composer require {}` or `composer require {}:{}` instead to replace the constraint</info>", + "<info>Run `shirabe require {}` or `shirabe require {}:{}` instead to replace the constraint</info>", package, package, constraint, )); diff --git a/crates/shirabe/src/command/validate_command.rs b/crates/shirabe/src/command/validate_command.rs index d460ea6c..16d3b4d0 100644 --- a/crates/shirabe/src/command/validate_command.rs +++ b/crates/shirabe/src/command/validate_command.rs @@ -306,7 +306,7 @@ impl Command for ValidateCommand { let locker = composer.get_locker().clone(); let mut locker = locker.borrow_mut(); if locker.is_locked() && !locker.is_fresh()? { - lock_errors.push("- The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update` or `composer update <package name>`.".to_string()); + lock_errors.push("- The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `shirabe update` or `shirabe update <package name>`.".to_string()); } if locker.is_locked() { diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index c9b06412..b4d98054 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -2046,7 +2046,7 @@ impl ApplicationHandle { if use_parent_dir_if_no_json_available.as_bool() == Some(true) { io.write_error(&format!("<info>No composer.json in current directory, changing working directory to {}</info>", dir)); } else { - io.write_error("<info>Always want to use the parent dir? Use \"composer config --global use-parent-dir true\" to change the default.</info>"); + io.write_error("<info>Always want to use the parent dir? Use \"shirabe config --global use-parent-dir true\" to change the default.</info>"); } old_working_dir = Some(Platform::get_cwd(true).unwrap_or_default()); chdir(&dir); diff --git a/crates/shirabe/src/dependency_resolver/problem.rs b/crates/shirabe/src/dependency_resolver/problem.rs index ba6f43bd..60e2d79b 100644 --- a/crates/shirabe/src/dependency_resolver/problem.rs +++ b/crates/shirabe/src/dependency_resolver/problem.rs @@ -414,7 +414,7 @@ impl Problem { return Ok(( msg, format!( - "the {} package is disabled by your platform config. Enable it again with \"composer config platform.{} --unset\".", + "the {} package is disabled by your platform config. Enable it again with \"shirabe config platform.{} --unset\".", package_name, package_name ), )); @@ -472,7 +472,7 @@ impl Problem { return Ok(( msg, format!( - "the {} package is disabled by your platform config. Enable it again with \"composer config platform.{} --unset\".{}", + "the {} package is disabled by your platform config. Enable it again with \"shirabe config platform.{} --unset\".{}", package_name, package_name, providers_str ), )); diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs index cf1bfd82..bfe7a627 100644 --- a/crates/shirabe/src/downloader/git_downloader.rs +++ b/crates/shirabe/src/downloader/git_downloader.rs @@ -461,7 +461,7 @@ impl GitDownloader { io_interface::NORMAL, ); exception_extra = format!( - "\nIt looks like the commit hash is not available in the repository, maybe {}? Run \"composer update {}\" to resolve this.", + "\nIt looks like the commit hash is not available in the repository, maybe {}? Run \"shirabe update {}\" to resolve this.", if package.is_dev() { "the commit was removed from the branch" } else { diff --git a/crates/shirabe/src/installer.rs b/crates/shirabe/src/installer.rs index d1e38542..ca1ca380 100644 --- a/crates/shirabe/src/installer.rs +++ b/crates/shirabe/src/installer.rs @@ -453,7 +453,7 @@ impl Installer { (if 1 == funding_count { "is" } else { "are" }), )); self.io - .write_error("<info>Use the `composer fund` command to find out more!</info>"); + .write_error("<info>Use the `shirabe fund` command to find out more!</info>"); } } @@ -590,7 +590,7 @@ impl Installer { { self.io.write_error3( &format!( - "<error>Cannot update {} without a lock file present. Run `composer update` to generate a lock file.</error>", + "<error>Cannot update {} without a lock file present. Run `shirabe update` to generate a lock file.</error>", if self.update_mirrors { "lock file information" } else { @@ -1052,7 +1052,7 @@ impl Installer { if !self.locker.borrow_mut().is_fresh()? { self.io.write_error3( - "<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.</warning>", + "<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `shirabe update` or `shirabe update <package name>`.</warning>", true, io_interface::QUIET, ); @@ -1129,7 +1129,7 @@ impl Installer { // installing the locked packages on this platform resulted in lock modifying operations, there wasn't a conflict, but the lock file as-is seems to not work on this system if !lock_transaction.get_operations().is_empty() { self.io.write_error3( - "<error>Your lock file cannot be installed on this system without changes. Please run composer update.</error>", + "<error>Your lock file cannot be installed on this system without changes. Please run shirabe update.</error>", true, io_interface::QUIET, ); @@ -1138,7 +1138,7 @@ impl Installer { } } Err(e) => { - let err = "Your lock file does not contain a compatible set of packages. Please run composer update."; + let err = "Your lock file does not contain a compatible set of packages. Please run shirabe update."; let pretty_problem = e.get_pretty_string( &repository_set, &request, diff --git a/crates/shirabe/src/installer/suggested_packages_reporter.rs b/crates/shirabe/src/installer/suggested_packages_reporter.rs index a450c869..6635fd91 100644 --- a/crates/shirabe/src/installer/suggested_packages_reporter.rs +++ b/crates/shirabe/src/installer/suggested_packages_reporter.rs @@ -151,7 +151,7 @@ impl SuggestedPackagesReporter { self.get_filtered_suggestions(installed_repo, only_dependents_of)?; if !suggested_packages.is_empty() { self.io.write_error(&format!( - "<info>{} package suggestions were added by new dependencies, use `composer suggest` to see details.</info>", + "<info>{} package suggestions were added by new dependencies, use `shirabe suggest` to see details.</info>", suggested_packages.len() )); } diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs index fed8318d..c4a06d77 100644 --- a/crates/shirabe/src/json/json_file.rs +++ b/crates/shirabe/src/json/json_file.rs @@ -490,7 +490,7 @@ impl JsonFile { php_regex!( r#"{\r?\n<<<<<<< [^\r\n]+\r?\n\s+"content-hash": *"[0-9a-f]+", *\r?\n(?:\|{7} [^\r\n]+\r?\n\s+"content-hash": *"[0-9a-f]+", *\r?\n)?=======\r?\n\s+"content-hash": *"[0-9a-f]+", *\r?\n>>>>>>> [^\r\n]+(\r?\n)}"# ), - " \"content-hash\": \"VCS merge conflict detected. Please run `composer update --lock`.\",$1", + " \"content-hash\": \"VCS merge conflict detected. Please run `shirabe update --lock`.\",$1", json, -1, Some(&mut count), diff --git a/crates/shirabe/src/package/locker.rs b/crates/shirabe/src/package/locker.rs index d6db1ab7..b98b8dae 100644 --- a/crates/shirabe/src/package/locker.rs +++ b/crates/shirabe/src/package/locker.rs @@ -194,7 +194,7 @@ impl Locker { if let Some(packages_dev) = lock_data.get("packages-dev").cloned() { locked_packages = array_merge(locked_packages, packages_dev); } else { - return Err(RuntimeException::new("The lock file does not contain require-dev information, run install with the --no-dev option or delete it and run composer update to generate a new lock file.".to_string()) + return Err(RuntimeException::new("The lock file does not contain require-dev information, run install with the --no-dev option or delete it and run shirabe update to generate a new lock file.".to_string()) .into()); } } @@ -268,7 +268,7 @@ impl Locker { } Err(RuntimeException::new( - "Your composer.lock is invalid. Run \"composer update\" to generate a new one." + "Your composer.lock is invalid. Run \"shirabe update\" to generate a new one." .to_string(), ) .into()) diff --git a/crates/shirabe/src/plugin/plugin_manager.rs b/crates/shirabe/src/plugin/plugin_manager.rs index 1ecb4153..04c53d08 100644 --- a/crates/shirabe/src/plugin/plugin_manager.rs +++ b/crates/shirabe/src/plugin/plugin_manager.rs @@ -1221,7 +1221,7 @@ impl PluginManager { if rules.is_none() { if !self.io.is_interactive() { self.io.write_error("<warning>For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins</warning>"); - self.io.write_error("<warning>This warning will become an exception once you run composer update!</warning>"); + self.io.write_error("<warning>This warning will become an exception once you run shirabe update!</warning>"); let mut m: IndexMap<String, bool> = IndexMap::new(); m.insert("{}".to_string(), true); diff --git a/crates/shirabe/src/util/bitbucket.rs b/crates/shirabe/src/util/bitbucket.rs index f50dc878..d42aa9d8 100644 --- a/crates/shirabe/src/util/bitbucket.rs +++ b/crates/shirabe/src/util/bitbucket.rs @@ -149,7 +149,7 @@ impl Bitbucket { io_interface::NORMAL, ); self.io.write_error3( - "You can also add it manually later by using \"composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>\"", + "You can also add it manually later by using \"shirabe config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>\"", true, io_interface::NORMAL, ); @@ -244,7 +244,7 @@ impl Bitbucket { io_interface::NORMAL, ); self.io.write_error3( - "You can also add it manually later by using \"composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>\"", + "You can also add it manually later by using \"shirabe config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>\"", true, io_interface::NORMAL, ); @@ -265,7 +265,7 @@ impl Bitbucket { io_interface::NORMAL, ); self.io.write_error3( - "You can also add it manually later by using \"composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>\"", + "You can also add it manually later by using \"shirabe config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>\"", true, io_interface::NORMAL, ); diff --git a/crates/shirabe/src/util/forgejo.rs b/crates/shirabe/src/util/forgejo.rs index 6c18e4f6..99e2d9bc 100644 --- a/crates/shirabe/src/util/forgejo.rs +++ b/crates/shirabe/src/util/forgejo.rs @@ -92,7 +92,7 @@ impl Forgejo { .unwrap_or_default(); let add_token_manually = format!( - "You can also add it manually later by using \"composer config --global --auth forgejo-token.{} <username> <token>\"", + "You can also add it manually later by using \"shirabe config --global --auth forgejo-token.{} <username> <token>\"", origin_url ); if token.is_empty() || username.is_empty() { diff --git a/crates/shirabe/src/util/github.rs b/crates/shirabe/src/util/github.rs index d4fd3283..5ec0acb1 100644 --- a/crates/shirabe/src/util/github.rs +++ b/crates/shirabe/src/util/github.rs @@ -205,7 +205,7 @@ impl GitHub { io_interface::NORMAL, ); self.io.write_error3( - "You can also add it manually later by using \"composer config --global --auth github-oauth.github.com <token>\"", + "You can also add it manually later by using \"shirabe config --global --auth github-oauth.github.com <token>\"", true, io_interface::NORMAL, ); @@ -245,7 +245,7 @@ impl GitHub { io_interface::NORMAL, ); self.io.write_error3( - "You can also add it manually later by using \"composer config --global --auth github-oauth.github.com <token>\"", + "You can also add it manually later by using \"shirabe config --global --auth github-oauth.github.com <token>\"", true, io_interface::NORMAL, ); diff --git a/crates/shirabe/src/util/gitlab.rs b/crates/shirabe/src/util/gitlab.rs index fa9bef69..e6e7a960 100644 --- a/crates/shirabe/src/util/gitlab.rs +++ b/crates/shirabe/src/util/gitlab.rs @@ -293,7 +293,7 @@ impl GitLab { ); self.io.write_error3( &format!( - "Add it using \"composer config --global --auth gitlab-token.{} <token>\"", + "Add it using \"shirabe config --global --auth gitlab-token.{} <token>\"", origin_url ), true, diff --git a/crates/shirabe/tests/all_functional_test.rs b/crates/shirabe/tests/all_functional_test.rs index 9879bca4..9f750717 100644 --- a/crates/shirabe/tests/all_functional_test.rs +++ b/crates/shirabe/tests/all_functional_test.rs @@ -125,6 +125,15 @@ fn clean_output(output: &str) -> String { String::from_utf8_lossy(&processed).into_owned() } +/// The fixtures come from Composer's tree and name the `composer` binary in the hints they expect +/// on stdout; Shirabe prints its own name there. +fn rename_binary_in_expected_output(expected: &str) -> String { + regex::Regex::new(r"\bcomposer (?P<cmd>config|fund|suggest|update)\b") + .unwrap() + .replace_all(expected, "shirabe $cmd") + .into_owned() +} + /// ref: the inline `--EXPECT--` matcher in AllFunctionalTest::testIntegration. Literal byte /// comparison, except `%regex%` spans in `expected` are matched as `{regex}` against the remaining /// output and consume whatever they match. @@ -216,9 +225,10 @@ fn run_integration(test_filename: &str) { let raw_output = String::from_utf8_lossy(&proc.stdout).into_owned(); if let Some(expected) = test_data.get("EXPECT") { + let expected = rename_binary_in_expected_output(expected); let output = clean_output(&raw_output); let output = output.trim(); - expect_matches(expected, output); + expect_matches(&expected, output); } if let Some(expect_regex) = test_data.get("EXPECT-REGEX") { assert!(preg_match(expect_regex, &clean_output(&raw_output)).is_some()); diff --git a/crates/shirabe/tests/command/base_dependency_command_test.rs b/crates/shirabe/tests/command/base_dependency_command_test.rs index 41aeec56..da9a51e7 100644 --- a/crates/shirabe/tests/command/base_dependency_command_test.rs +++ b/crates/shirabe/tests/command/base_dependency_command_test.rs @@ -240,7 +240,7 @@ fn test_exception_when_package_was_not_found_in_project() { #[test] #[serial] fn test_warning_when_dependencies_are_not_installed() { - let expected_warning_message = "<warning>No dependencies installed. Try running composer install or update, or use --locked.</warning>"; + let expected_warning_message = "<warning>No dependencies installed. Try running shirabe install or update, or use --locked.</warning>"; // caseProvider let cases: Vec<(&str, Vec<(&str, InputValue)>)> = vec![ @@ -469,7 +469,7 @@ fn test_why_not_command_outputs() { "3.*", "Package \"vendor1/package1\" could not be found with constraint \"3.*\", results below will most likely be incomplete.\n\ __root__ - requires vendor1/package1 (1.*)\n\ - Not finding what you were looking for? Try calling `composer require \"vendor1/package1:3.*\" --dry-run` to get another view on the problem.", + Not finding what you were looking for? Try calling `shirabe require \"vendor1/package1:3.*\" --dry-run` to get another view on the problem.", 1, ), ( @@ -477,20 +477,20 @@ fn test_why_not_command_outputs() { "^1.4", "Package \"vendor1/package1\" could not be found with constraint \"^1.4\", results below will most likely be incomplete.\n\ There is no installed package depending on \"vendor1/package1\" in versions not matching ^1.4\n\ - Not finding what you were looking for? Try calling `composer require \"vendor1/package1:^1.4\" --dry-run` to get another view on the problem.", + Not finding what you were looking for? Try calling `shirabe require \"vendor1/package1:^1.4\" --dry-run` to get another view on the problem.", 0, ), ( "vendor1/package1", "^1.3", - "Package \"vendor1/package1\" 1.3.0 is already installed! To find out why, run `composer why vendor1/package1`", + "Package \"vendor1/package1\" 1.3.0 is already installed! To find out why, run `shirabe why vendor1/package1`", 0, ), ( "vendor2/package3", "1.5.0", "vendor2/package2 1.0.0 requires vendor2/package3 (1.4.*)\n\ - Not finding what you were looking for? Try calling `composer update \"vendor2/package3:1.5.0\" --dry-run` to get another view on the problem.", + Not finding what you were looking for? Try calling `shirabe update \"vendor2/package3:1.5.0\" --dry-run` to get another view on the problem.", 1, ), ( diff --git a/crates/shirabe/tests/command/install_command_test.rs b/crates/shirabe/tests/command/install_command_test.rs index 11afd464..abf489ab 100644 --- a/crates/shirabe/tests/command/install_command_test.rs +++ b/crates/shirabe/tests/command/install_command_test.rs @@ -50,13 +50,13 @@ Generating autoload files"#, "packages", InputValue::Array(vec!["vendor/package".to_string()]), )], - r#"Invalid argument vendor/package. Use "composer require vendor/package" instead to add packages to your composer.json."#, + r#"Invalid argument vendor/package. Use "shirabe require vendor/package" instead to add packages to your composer.json."#, ), ( "it writes an error when no-install flag is passed", serde_json::json!({ "repositories": [] }), vec![("--no-install", InputValue::from(true))], - r#"Invalid option "--no-install". Use "composer update --no-install" instead if you are trying to update the composer.lock file."#, + r#"Invalid option "--no-install". Use "shirabe update --no-install" instead if you are trying to update the composer.lock file."#, ), ] } diff --git a/crates/shirabe/tests/command/remove_command_test.rs b/crates/shirabe/tests/command/remove_command_test.rs index 377d78c0..a36043e0 100644 --- a/crates/shirabe/tests/command/remove_command_test.rs +++ b/crates/shirabe/tests/command/remove_command_test.rs @@ -306,7 +306,7 @@ fn test_remove_unused_package() { assert!( app_tester .get_display() - .contains("Running composer update not/req"), + .contains("Running shirabe update not/req"), "got: {}", app_tester.get_display() ); @@ -373,7 +373,7 @@ fn test_remove_package_by_name() { display ); assert!( - trimmed.contains("Running composer update root/req"), + trimmed.contains("Running shirabe update root/req"), "got: {}", display ); @@ -455,7 +455,7 @@ fn test_remove_package_by_name_with_dry_run() { display ); assert!( - trimmed.contains("Running composer update root/req"), + trimmed.contains("Running shirabe update root/req"), "got: {}", display ); @@ -649,7 +649,7 @@ fn test_remove_packages_by_vendor() { display ); assert!( - display.contains("Running composer update root/*"), + display.contains("Running shirabe update root/*"), "got: {}", display ); @@ -723,7 +723,7 @@ fn test_remove_packages_by_vendor_with_dry_run() { assert_eq!(SUCCESS, app_tester.get_status_code()); assert_eq!( "./composer.json has been updated -Running composer update root/* +Running shirabe update root/* Loading composer repositories with package information Updating dependencies Lock file operations: 0 installs, 0 updates, 2 removals @@ -843,7 +843,7 @@ fn test_package_still_present_error_when_no_install_flag_used() { assert!(display.contains("Writing lock file"), "got: {}", display); assert!( display.contains( - "Removal failed, root/req is still present, it may be required by another package. See `composer why root/req`" + "Removal failed, root/req is still present, it may be required by another package. See `shirabe why root/req`" ), "got: {}", display @@ -956,16 +956,16 @@ fn test_update_inherited_dependencies_flag_is_passed_to_post_remove_installer() // 'update with all dependencies' run_update_inherited_dependencies_flag_case( "--update-with-all-dependencies", - "Running composer update root/req --with-all-dependencies", + "Running shirabe update root/req --with-all-dependencies", ); // 'with all dependencies' run_update_inherited_dependencies_flag_case( "--with-all-dependencies", - "Running composer update root/req --with-all-dependencies", + "Running shirabe update root/req --with-all-dependencies", ); // 'no update with dependencies' run_update_inherited_dependencies_flag_case( "--no-update-with-dependencies", - "Running composer update root/req --with-dependencies", + "Running shirabe update root/req --with-dependencies", ); } diff --git a/crates/shirabe/tests/command/require_command_test.rs b/crates/shirabe/tests/command/require_command_test.rs index a4f3bb9c..897d8d2f 100644 --- a/crates/shirabe/tests/command/require_command_test.rs +++ b/crates/shirabe/tests/command/require_command_test.rs @@ -99,7 +99,7 @@ fn test_require_warns_if_resolved_to_feature_branch() { assert_eq!( "./composer.json has been updated -Running composer update required/pkg +Running shirabe update required/pkg Loading composer repositories with package information Updating dependencies Lock file operations: 2 installs, 0 updates, 0 removals @@ -138,7 +138,7 @@ fn provide_require() -> Vec<( vec![("packages", InputValue::Array(vec!["required/pkg".to_string()]))], "<warning>Cannot use required/pkg's latest version 1.2.0 as it requires ext-foobar ^1 which is missing from your platform. ./composer.json has been updated -Running composer update required/pkg +Running shirabe update required/pkg Loading composer repositories with package information Updating dependencies Lock file operations: 1 install, 0 updates, 0 removals @@ -165,7 +165,7 @@ Using version ^1.0 for required/pkg", "<warning>Cannot use required/pkg's latest version 1.2.0 as it requires ext-foobar ^1 which is missing from your platform. <warning>Cannot use required/pkg 1.1.0 as it requires ext-foobar ^1 which is missing from your platform. ./composer.json has been updated -Running composer update required/pkg +Running shirabe update required/pkg Loading composer repositories with package information Updating dependencies Dependency resolution completed in %d seconds @@ -190,7 +190,7 @@ Using version ^1.0 for required/pkg", ], "<warning>Cannot use required/pkg's latest version 1.1.0 as it requires php ^20 which is not satisfied by your platform. ./composer.json has been updated -Running composer update required/pkg +Running shirabe update required/pkg Loading composer repositories with package information Updating dependencies Lock file operations: 1 install, 0 updates, 0 removals @@ -229,7 +229,7 @@ Using version ^1.0 for required/pkg ("--no-install", InputValue::from(true)), ], "./composer.json has been updated -Running composer update required/pkg +Running shirabe update required/pkg Loading composer repositories with package information Updating dependencies Lock file operations: 2 installs, 0 updates, 0 removals @@ -251,7 +251,7 @@ Using version ^1.1 for required/pkg", ("--fixed", InputValue::from(true)), ], "./composer.json has been updated -Running composer update required/pkg +Running shirabe update required/pkg Loading composer repositories with package information Updating dependencies Lock file operations: 1 install, 0 updates, 0 removals diff --git a/crates/shirabe/tests/command/show_command_test.rs b/crates/shirabe/tests/command/show_command_test.rs index 3834b016..a35f6500 100644 --- a/crates/shirabe/tests/command/show_command_test.rs +++ b/crates/shirabe/tests/command/show_command_test.rs @@ -1105,7 +1105,7 @@ fn test_not_installed_error() { app_tester .get_display() .trim() - .contains("No dependencies installed. Try running composer install or update."), + .contains("No dependencies installed. Try running shirabe install or update."), "Should show error message when no dependencies are installed" ); } diff --git a/crates/shirabe/tests/command/update_command_test.rs b/crates/shirabe/tests/command/update_command_test.rs index 6fe8f927..e4d3cb71 100644 --- a/crates/shirabe/tests/command/update_command_test.rs +++ b/crates/shirabe/tests/command/update_command_test.rs @@ -148,7 +148,7 @@ Your requirements could not be resolved to an installable set of packages. root_dep_and_transitive_dep(), vec![("--with", InputValue::Array(vec!["root/req:^2".to_string()]))], "The temporary constraint \"^2\" for \"root/req\" must be a subset of the constraint in your composer.json (1.*) -Run `composer require root/req` or `composer require root/req:^2` instead to replace the constraint", +Run `shirabe require root/req` or `shirabe require root/req:^2` instead to replace the constraint", false, ), ( @@ -166,7 +166,7 @@ Package operations: 2 installs, 0 updates, 0 removals - Installing root/req (1.0.0) Bumping dependencies <warning>Warning: Bumping dependency constraints is not recommended for libraries as it will narrow down your dependencies and may cause problems for your users.</warning> -<warning>If your package is not a library, you can explicitly specify the \"type\" by using \"composer config type project\".</warning> +<warning>If your package is not a library, you can explicitly specify the \"type\" by using \"shirabe config type project\".</warning> <warning>Alternatively you can use --bump-after-update=dev to only bump dependencies within \"require-dev\".</warning> No requirements to update in ./composer.json.", true, diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs index 922fbd45..597f8b86 100644 --- a/crates/shirabe/tests/installer_test.rs +++ b/crates/shirabe/tests/installer_test.rs @@ -569,6 +569,15 @@ struct IntegrationCase { expect_result: ExpectResult, } +/// The fixtures come from Composer's tree and name the `composer` binary in the hints they expect +/// on stdout; Shirabe prints its own name there. +fn rename_binary_in_expected_output(expected: String) -> String { + regex::Regex::new(r"\bcomposer (?P<cmd>config|fund|suggest|update)\b") + .unwrap() + .replace_all(&expected, "shirabe $cmd") + .into_owned() +} + fn fixtures_dir(path: &str) -> std::path::PathBuf { std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .join("../../composer/tests/Composer/Test/Fixtures") @@ -752,8 +761,14 @@ fn load_integration_tests(path: &str) -> Vec<IntegrationCase> { .filter(|s| !s.is_empty()) .map(|s| serde_json::from_str(s).unwrap()); - let expect_output = test_data.get("EXPECT-OUTPUT").cloned(); - let expect_output_optimized = test_data.get("EXPECT-OUTPUT-OPTIMIZED").cloned(); + let expect_output = test_data + .get("EXPECT-OUTPUT") + .cloned() + .map(rename_binary_in_expected_output); + let expect_output_optimized = test_data + .get("EXPECT-OUTPUT-OPTIMIZED") + .cloned() + .map(rename_binary_in_expected_output); let expect = test_data["EXPECT"].clone(); let expect_result = diff --git a/crates/shirabe/tests/json/json_file_test.rs b/crates/shirabe/tests/json/json_file_test.rs index 490571ec..62476619 100644 --- a/crates/shirabe/tests/json/json_file_test.rs +++ b/crates/shirabe/tests/json/json_file_test.rs @@ -469,7 +469,7 @@ fn merge_conflict_simple_data() -> PhpMixed { data.insert( "content-hash".to_string(), PhpMixed::String( - "VCS merge conflict detected. Please run `composer update --lock`.".to_string(), + "VCS merge conflict detected. Please run `shirabe update --lock`.".to_string(), ), ); data.insert("packages".to_string(), PhpMixed::List(vec![])); @@ -542,7 +542,7 @@ fn test_composer_lock_file_merge_conflict_extended() { let json = JsonFile::parse_json(Some(&data), Some("/path/to/composer.lock")).unwrap(); assert_eq!( - "VCS merge conflict detected. Please run `composer update --lock`.", + "VCS merge conflict detected. Please run `shirabe update --lock`.", json.as_array() .unwrap() .get("content-hash") diff --git a/crates/shirabe/tests/util/bitbucket_test.rs b/crates/shirabe/tests/util/bitbucket_test.rs index 19641fed..c6b3f619 100644 --- a/crates/shirabe/tests/util/bitbucket_test.rs +++ b/crates/shirabe/tests/util/bitbucket_test.rs @@ -388,7 +388,7 @@ fn test_request_access_token_with_username_and_password_with_unauthorized_respon Expectation::auth(ORIGIN, USERNAME, Some(PASSWORD.to_string())), Expectation::text("Invalid OAuth consumer provided."), Expectation::text( - "You can also add it manually later by using \"composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>\"", + "You can also add it manually later by using \"shirabe config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>\"", ), ], true, |
