fix: config-path correctly displays the config file used even if --config-file is passed
Check / stable / fmt (push) Failing after 27s
Check / beta / clippy (push) Failing after 1m11s
Check / stable / clippy (push) Failing after 1m11s
Check / nightly / doc (push) Successful in 1m1s
Check / 1.95.0 / check (push) Successful in 1m8s
Check / dockerfile / msrv (push) Successful in 5s
Test Suite / ubuntu / beta (push) Successful in 2m17s
Test Suite / ubuntu / stable (push) Successful in 2m16s
Test Suite / ubuntu / stable / coverage (push) Failing after 1m57s
Test Suite / macos-latest / stable (push) Canceled after 0s
Test Suite / windows-latest / stable (push) Canceled after 0s

This commit is contained in:
Dark-Alex-17 committed 2026-10-14 12:56:31 -06:00
1 parent 947b3c2eda
commit 21749a62ea
3 files changed
+11 -6

No files matched your search

+2 -2
View File
@@ -51,8 +51,8 @@ pub enum Command {
},
#[command(about = indoc!{"
Print the full path to the default configuration file.
This file can be changed to another location using the '--config-file' flag
Print the full path to the configuration file in use.
This is the default configuration file location unless overridden with the '--config-file' flag
"})]
ConfigPath,
}
+4 -1
View File
@@ -131,7 +131,10 @@ async fn main() -> Result<()> {
let default_config_path = config_file_path.display().to_string();
if matches!(args.command, Some(Command::ConfigPath)) {
println!("{default_config_path}");
match args.global.config_file {
Some(ref config_file) => println!("{}", config_file.display()),
None => println!("{default_config_path}"),
}
return Ok(());
}
@@ -197,9 +197,11 @@ fn config_path_succeeds_without_loadable_tls_certificates() {
let output = assertion.get_output();
let stderr = str::from_utf8(&output.stderr).unwrap();
assert!(
!output.stdout.is_empty(),
"config-path produced no stdout despite exiting successfully"
let stdout = str::from_utf8(&output.stdout).unwrap();
assert_eq!(
stdout.trim_end(),
env.base.join("config.yml").display().to_string(),
"config-path did not print the config file passed via --config-file"
);
assert!(
!stderr.contains("builder error"),