From 2a26014465b24834788b0b6b944406e9cc2c33b2 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 3 Jul 2022 17:10:07 +0200 Subject: [PATCH] [yabridgectl] Let rustfmt handle string wrapping --- tools/yabridgectl/.rustfmt.toml | 1 + tools/yabridgectl/src/actions.rs | 17 +++++---- tools/yabridgectl/src/config.rs | 2 +- tools/yabridgectl/src/files.rs | 4 +-- tools/yabridgectl/src/main.rs | 62 +++++++++++++++++++------------- tools/yabridgectl/src/symbols.rs | 4 +-- tools/yabridgectl/src/util.rs | 11 +++--- 7 files changed, 60 insertions(+), 41 deletions(-) create mode 100644 tools/yabridgectl/.rustfmt.toml diff --git a/tools/yabridgectl/.rustfmt.toml b/tools/yabridgectl/.rustfmt.toml new file mode 100644 index 00000000..a5a68066 --- /dev/null +++ b/tools/yabridgectl/.rustfmt.toml @@ -0,0 +1 @@ +format_strings = true diff --git a/tools/yabridgectl/src/actions.rs b/tools/yabridgectl/src/actions.rs index 9ecdb140..a63cd93a 100644 --- a/tools/yabridgectl/src/actions.rs +++ b/tools/yabridgectl/src/actions.rs @@ -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 canonical_plugin_dir.starts_with(&canonical_vst2_home) { anyhow::bail!( - "'~/.vst/yabridge' is a symlink to '{}'. \ - This conflicts with '{}' from your plugin directories, so the syncing process will now be aborted.", + "'~/.vst/yabridge' is a symlink to '{}'. This conflicts with '{}' \ + from your plugin directories, so the syncing process will now be \ + aborted.", canonical_vst2_home.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 canonical_plugin_dir.starts_with(&canonical_vst3_home) { anyhow::bail!( - "'~/.vst3/yabridge' is a symlink to '{}'. \ - This conflicts with '{}' from your plugin directories, so the syncing process will now be aborted.", + "'~/.vst3/yabridge' is a symlink to '{}'. This conflicts with '{}' \ + from your plugin directories, so the syncing process will now be \ + aborted.", canonical_vst3_home.display(), plugin_dir.display(), ); @@ -365,7 +367,8 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> { eprintln!( "{}", 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(), target_windows_plugin_path.display(), )) @@ -443,8 +446,8 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> { eprintln!( "{}", util::wrap(&format!( - "{}: The {} version of '{}' has already been provided by another Wine \ - prefix or plugin directory, skipping '{}'\n", + "{}: The {} version of '{}' has already been provided by another \ + Wine prefix or plugin directory, skipping '{}'\n", "WARNING".red(), module.architecture, module.target_bundle_home().display(), diff --git a/tools/yabridgectl/src/config.rs b/tools/yabridgectl/src/config.rs index 523a083b..2fa84ba2 100644 --- a/tools/yabridgectl/src/config.rs +++ b/tools/yabridgectl/src/config.rs @@ -238,7 +238,7 @@ impl Config { _ => { return Err(anyhow!( "Could not find '{}' in either '{}' or '{}'. You can override the \ - default search path using 'yabridgectl set --path='.", + default search path using 'yabridgectl set --path='.", VST2_CHAINLOADER_NAME, system_path.display(), user_path.display() diff --git a/tools/yabridgectl/src/files.rs b/tools/yabridgectl/src/files.rs index 511d335a..a41ae4f1 100644 --- a/tools/yabridgectl/src/files.rs +++ b/tools/yabridgectl/src/files.rs @@ -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. if file_idx == 100_000 { eprintln!( - "Indexed over 100.000 files, press Ctrl+C to cancel this operation if this was not \ - intentional." + "Indexed over 100.000 files, press Ctrl+C to cancel this operation if this was \ + not intentional." ) } diff --git a/tools/yabridgectl/src/main.rs b/tools/yabridgectl/src/main.rs index 302ff8ae..8f88cf7b 100644 --- a/tools/yabridgectl/src/main.rs +++ b/tools/yabridgectl/src/main.rs @@ -55,7 +55,8 @@ fn main() -> Result<()> { config.blacklist.iter().map(|path| path.as_path()).collect(); let matches = command!() - .subcommand_required(true).arg_required_else_help(true) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("add") .about("Add a plugin install location") @@ -127,45 +128,56 @@ fn main() -> Result<()> { .arg( Arg::new("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( - "Path to the directory containing 'libyabridge-chainloader-{vst2,vst3}.so'. \ - If this is not set, then yabridgectl will look in both '/usr/lib' and \ + "Path to the directory containing \ + 'libyabridge-chainloader-{vst2,vst3}.so'. If this is not set, then \ + yabridgectl will look in both '/usr/lib' and \ '~/.local/share/yabridge' by default.", ) .validator(validate_path) - .takes_value(true).conflicts_with("path_auto"), + .takes_value(true) + .conflicts_with("path_auto"), ) .arg( Arg::new("path_auto") .long("path-auto") .help("Automatically locate yabridge's files") .long_help( - "Automatically locate yabridge's files. This can be used after manually \ - setting a path with the '--path' option to revert back to the default \ - auto detection behaviour.", + "Automatically locate yabridge's files. This can be used after \ + manually setting a path with the '--path' option to revert back to \ + the default auto detection behaviour.", ), ) .arg( Arg::new("vst2_location") .long("vst2-location") .help("Where to set up VST2 plugins") - .long_help(format!( - "Where to set up VST2 plugins. \ - '{}' (the default) causes bridged VST2 plugins to be set up in `~/.vst/yabridge.` \ - '{}' causes bridged VST2 plugins to be set up next to the original '.dll' file.", - "centralized".bright_white(), - "inline".bright_white() - ).as_ref()) + .long_help( + format!( + "Where to set up VST2 plugins. '{}' (the default) causes bridged \ + VST2 plugins to be set up in `~/.vst/yabridge.` '{}' causes \ + bridged VST2 plugins to be set up next to the original '.dll' \ + file.", + "centralized".bright_white(), + "inline".bright_white() + ) + .as_ref(), + ) .possible_values(["centralized", "inline"]) .takes_value(true), - ).arg( + ) + .arg( Arg::new("no_verify") .long("no-verify") .help("Always skip post-installation setup checks") .long_help( - "Always skip post-installation setup checks. This can be set temporarily \ - by passing the '--no-verify' option to 'yabridgectl sync'.", + "Always skip post-installation setup checks. This can be set \ + temporarily by passing the '--no-verify' option to 'yabridgectl \ + sync'.", ) .possible_values(["true", "false"]) .takes_value(true), @@ -175,12 +187,12 @@ fn main() -> Result<()> { Command::new("blacklist") .about("Manage the indexing blacklist (advanced)") .display_order(201) - .subcommand_required(true).arg_required_else_help(true) + .subcommand_required(true) + .arg_required_else_help(true) .long_about( - "Manage the indexing blacklist (advanced)\n\ - \n\ - This lets you skip over individual files and entire directories in the \ - indexing process. You most likely won't have to use this feature.", + "Manage the indexing blacklist (advanced)\n\nThis lets you skip over \ + individual files and entire directories in the indexing process. You most \ + likely won't have to use this feature.", ) .subcommand( Command::new("add") @@ -201,7 +213,9 @@ fn main() -> Result<()> { .arg( Arg::new("path") .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) .takes_value(true) .required(true), diff --git a/tools/yabridgectl/src/symbols.rs b/tools/yabridgectl/src/symbols.rs index 37d68d49..04340ce2 100644 --- a/tools/yabridgectl/src/symbols.rs +++ b/tools/yabridgectl/src/symbols.rs @@ -72,8 +72,8 @@ fn parse_pe32_winedump>(binary: P) -> Result { .arg(path) .output() .context( - "Could not find 'winedump'. In some distributions this is part of a seperate \ - Wine tools package.", + "Could not find 'winedump'. In some distributions this is part of a seperate Wine \ + tools package.", ) .map(|output| output.stdout) }; diff --git a/tools/yabridgectl/src/util.rs b/tools/yabridgectl/src/util.rs index ad978f51..cffb3318 100644 --- a/tools/yabridgectl/src/util.rs +++ b/tools/yabridgectl/src/util.rs @@ -326,9 +326,10 @@ pub fn verify_path_setup(config: &Config) -> Result { eprintln!( "\n{}", wrap(&format!( - "Warning: could not run {} as a login shell, skipping PATH setup check: \ - {}", - shell.bright_white(), err + "Warning: could not run {} as a login shell, skipping PATH setup \ + check: {}", + shell.bright_white(), + err )) ); @@ -473,8 +474,8 @@ pub fn verify_external_dependencies() -> Result<()> { wrap(&format!( "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 \ - usually part of the libnotify package, but your distro might have moved it into a \ - separate libnotify-tools package.", + usually part of the libnotify package, but your distro might have moved it into \ + a separate libnotify-tools package.", "notify-send".bright_white(), )) );