[yabridgectl] Let rustfmt handle string wrapping

This commit is contained in:
Robbert van der Helm
2022-07-03 17:10:07 +02:00
parent 387d2bed4b
commit 2a26014465
7 changed files with 60 additions and 41 deletions
+1
View File
@@ -0,0 +1 @@
format_strings = true
+10 -7
View File
@@ -272,8 +272,9 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
if let Ok(canonical_plugin_dir) = fs::canonicalize(&plugin_dir) { if let Ok(canonical_plugin_dir) = fs::canonicalize(&plugin_dir) {
if canonical_plugin_dir.starts_with(&canonical_vst2_home) { if canonical_plugin_dir.starts_with(&canonical_vst2_home) {
anyhow::bail!( anyhow::bail!(
"'~/.vst/yabridge' is a symlink to '{}'. \ "'~/.vst/yabridge' is a symlink to '{}'. This conflicts with '{}' \
This conflicts with '{}' from your plugin directories, so the syncing process will now be aborted.", from your plugin directories, so the syncing process will now be \
aborted.",
canonical_vst2_home.display(), canonical_vst2_home.display(),
plugin_dir.display(), plugin_dir.display(),
); );
@@ -288,8 +289,9 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
if let Ok(canonical_plugin_dir) = fs::canonicalize(&plugin_dir) { if let Ok(canonical_plugin_dir) = fs::canonicalize(&plugin_dir) {
if canonical_plugin_dir.starts_with(&canonical_vst3_home) { if canonical_plugin_dir.starts_with(&canonical_vst3_home) {
anyhow::bail!( anyhow::bail!(
"'~/.vst3/yabridge' is a symlink to '{}'. \ "'~/.vst3/yabridge' is a symlink to '{}'. This conflicts with '{}' \
This conflicts with '{}' from your plugin directories, so the syncing process will now be aborted.", from your plugin directories, so the syncing process will now be \
aborted.",
canonical_vst3_home.display(), canonical_vst3_home.display(),
plugin_dir.display(), plugin_dir.display(),
); );
@@ -365,7 +367,8 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
eprintln!( eprintln!(
"{}", "{}",
util::wrap(&format!( util::wrap(&format!(
"{}: '{}' has already been provided by another Wine prefix or plugin directory, skipping it\n", "{}: '{}' has already been provided by another Wine \
prefix or plugin directory, skipping it\n",
"WARNING".red(), "WARNING".red(),
target_windows_plugin_path.display(), target_windows_plugin_path.display(),
)) ))
@@ -443,8 +446,8 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
eprintln!( eprintln!(
"{}", "{}",
util::wrap(&format!( util::wrap(&format!(
"{}: The {} version of '{}' has already been provided by another Wine \ "{}: The {} version of '{}' has already been provided by another \
prefix or plugin directory, skipping '{}'\n", Wine prefix or plugin directory, skipping '{}'\n",
"WARNING".red(), "WARNING".red(),
module.architecture, module.architecture,
module.target_bundle_home().display(), module.target_bundle_home().display(),
+1 -1
View File
@@ -238,7 +238,7 @@ impl Config {
_ => { _ => {
return Err(anyhow!( return Err(anyhow!(
"Could not find '{}' in either '{}' or '{}'. You can override the \ "Could not find '{}' in either '{}' or '{}'. You can override the \
default search path using 'yabridgectl set --path=<path>'.", default search path using 'yabridgectl set --path=<path>'.",
VST2_CHAINLOADER_NAME, VST2_CHAINLOADER_NAME,
system_path.display(), system_path.display(),
user_path.display() user_path.display()
+2 -2
View File
@@ -472,8 +472,8 @@ pub fn index(directory: &Path, blacklist: &HashSet<&Path>) -> SearchIndex {
// at least tell the user what's happening and that they can safely cancel the scan. // at least tell the user what's happening and that they can safely cancel the scan.
if file_idx == 100_000 { if file_idx == 100_000 {
eprintln!( eprintln!(
"Indexed over 100.000 files, press Ctrl+C to cancel this operation if this was not \ "Indexed over 100.000 files, press Ctrl+C to cancel this operation if this was \
intentional." not intentional."
) )
} }
+38 -24
View File
@@ -55,7 +55,8 @@ fn main() -> Result<()> {
config.blacklist.iter().map(|path| path.as_path()).collect(); config.blacklist.iter().map(|path| path.as_path()).collect();
let matches = command!() let matches = command!()
.subcommand_required(true).arg_required_else_help(true) .subcommand_required(true)
.arg_required_else_help(true)
.subcommand( .subcommand(
Command::new("add") Command::new("add")
.about("Add a plugin install location") .about("Add a plugin install location")
@@ -127,45 +128,56 @@ fn main() -> Result<()> {
.arg( .arg(
Arg::new("path") Arg::new("path")
.long("path") .long("path")
.help("Path to the directory containing 'libyabridge-chainloader-{vst2,vst3}.so'") .help(
"Path to the directory containing \
'libyabridge-chainloader-{vst2,vst3}.so'",
)
.long_help( .long_help(
"Path to the directory containing 'libyabridge-chainloader-{vst2,vst3}.so'. \ "Path to the directory containing \
If this is not set, then yabridgectl will look in both '/usr/lib' and \ 'libyabridge-chainloader-{vst2,vst3}.so'. If this is not set, then \
yabridgectl will look in both '/usr/lib' and \
'~/.local/share/yabridge' by default.", '~/.local/share/yabridge' by default.",
) )
.validator(validate_path) .validator(validate_path)
.takes_value(true).conflicts_with("path_auto"), .takes_value(true)
.conflicts_with("path_auto"),
) )
.arg( .arg(
Arg::new("path_auto") Arg::new("path_auto")
.long("path-auto") .long("path-auto")
.help("Automatically locate yabridge's files") .help("Automatically locate yabridge's files")
.long_help( .long_help(
"Automatically locate yabridge's files. This can be used after manually \ "Automatically locate yabridge's files. This can be used after \
setting a path with the '--path' option to revert back to the default \ manually setting a path with the '--path' option to revert back to \
auto detection behaviour.", the default auto detection behaviour.",
), ),
) )
.arg( .arg(
Arg::new("vst2_location") Arg::new("vst2_location")
.long("vst2-location") .long("vst2-location")
.help("Where to set up VST2 plugins") .help("Where to set up VST2 plugins")
.long_help(format!( .long_help(
"Where to set up VST2 plugins. \ format!(
'{}' (the default) causes bridged VST2 plugins to be set up in `~/.vst/yabridge.` \ "Where to set up VST2 plugins. '{}' (the default) causes bridged \
'{}' causes bridged VST2 plugins to be set up next to the original '.dll' file.", VST2 plugins to be set up in `~/.vst/yabridge.` '{}' causes \
"centralized".bright_white(), bridged VST2 plugins to be set up next to the original '.dll' \
"inline".bright_white() file.",
).as_ref()) "centralized".bright_white(),
"inline".bright_white()
)
.as_ref(),
)
.possible_values(["centralized", "inline"]) .possible_values(["centralized", "inline"])
.takes_value(true), .takes_value(true),
).arg( )
.arg(
Arg::new("no_verify") Arg::new("no_verify")
.long("no-verify") .long("no-verify")
.help("Always skip post-installation setup checks") .help("Always skip post-installation setup checks")
.long_help( .long_help(
"Always skip post-installation setup checks. This can be set temporarily \ "Always skip post-installation setup checks. This can be set \
by passing the '--no-verify' option to 'yabridgectl sync'.", temporarily by passing the '--no-verify' option to 'yabridgectl \
sync'.",
) )
.possible_values(["true", "false"]) .possible_values(["true", "false"])
.takes_value(true), .takes_value(true),
@@ -175,12 +187,12 @@ fn main() -> Result<()> {
Command::new("blacklist") Command::new("blacklist")
.about("Manage the indexing blacklist (advanced)") .about("Manage the indexing blacklist (advanced)")
.display_order(201) .display_order(201)
.subcommand_required(true).arg_required_else_help(true) .subcommand_required(true)
.arg_required_else_help(true)
.long_about( .long_about(
"Manage the indexing blacklist (advanced)\n\ "Manage the indexing blacklist (advanced)\n\nThis lets you skip over \
\n\ individual files and entire directories in the indexing process. You most \
This lets you skip over individual files and entire directories in the \ likely won't have to use this feature.",
indexing process. You most likely won't have to use this feature.",
) )
.subcommand( .subcommand(
Command::new("add") Command::new("add")
@@ -201,7 +213,9 @@ fn main() -> Result<()> {
.arg( .arg(
Arg::new("path") Arg::new("path")
.help("Path to a previously added file or directory") .help("Path to a previously added file or directory")
.validator(|path| match_in_path_list(Path::new(path), &blacklist_entries)) .validator(|path| {
match_in_path_list(Path::new(path), &blacklist_entries)
})
.validator(validate_path) .validator(validate_path)
.takes_value(true) .takes_value(true)
.required(true), .required(true),
+2 -2
View File
@@ -72,8 +72,8 @@ fn parse_pe32_winedump<P: AsRef<Path>>(binary: P) -> Result<Pe32Info> {
.arg(path) .arg(path)
.output() .output()
.context( .context(
"Could not find 'winedump'. In some distributions this is part of a seperate \ "Could not find 'winedump'. In some distributions this is part of a seperate Wine \
Wine tools package.", tools package.",
) )
.map(|output| output.stdout) .map(|output| output.stdout)
}; };
+6 -5
View File
@@ -326,9 +326,10 @@ pub fn verify_path_setup(config: &Config) -> Result<bool> {
eprintln!( eprintln!(
"\n{}", "\n{}",
wrap(&format!( wrap(&format!(
"Warning: could not run {} as a login shell, skipping PATH setup check: \ "Warning: could not run {} as a login shell, skipping PATH setup \
{}", check: {}",
shell.bright_white(), err shell.bright_white(),
err
)) ))
); );
@@ -473,8 +474,8 @@ pub fn verify_external_dependencies() -> Result<()> {
wrap(&format!( wrap(&format!(
"Warning: Could not find '{}'. This will not prevent yabridge from working, but \ "Warning: Could not find '{}'. This will not prevent yabridge from working, but \
you will also not receive any notifcations when something is wrong. It is \ you will also not receive any notifcations when something is wrong. It is \
usually part of the libnotify package, but your distro might have moved it into a \ usually part of the libnotify package, but your distro might have moved it into \
separate libnotify-tools package.", a separate libnotify-tools package.",
"notify-send".bright_white(), "notify-send".bright_white(),
)) ))
); );