mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
[yabridgectl] Allow permanently disabling checks
This commit is contained in:
@@ -138,6 +138,7 @@ pub struct SetOptions<'a> {
|
||||
pub method: Option<&'a str>,
|
||||
pub path: Option<PathBuf>,
|
||||
pub path_auto: bool,
|
||||
pub no_verify: Option<bool>,
|
||||
}
|
||||
|
||||
/// Change configuration settings. The actual options are defined in the clap [app](clap::App).
|
||||
@@ -157,6 +158,10 @@ pub fn set_settings(config: &mut Config, options: &SetOptions) -> Result<()> {
|
||||
config.yabridge_home = None;
|
||||
}
|
||||
|
||||
if let Some(no_verify) = options.no_verify {
|
||||
config.no_verify = no_verify;
|
||||
}
|
||||
|
||||
config.write()
|
||||
}
|
||||
|
||||
@@ -383,7 +388,9 @@ pub fn do_sync(config: &mut Config, options: &SyncOptions) -> Result<()> {
|
||||
num_skipped_files
|
||||
);
|
||||
|
||||
if options.no_verify {
|
||||
// Skipping the post-installation seting checks can be done only for this invocation of
|
||||
// `yabridgectl sync`, or it can be skipped permanently through a config file option
|
||||
if options.no_verify || config.no_verify {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ const YABRIDGE_VST3_HOME: &str = ".vst3/yabridge";
|
||||
/// The configuration used for yabridgectl. This will be serialized to and deserialized from
|
||||
/// `$XDG_CONFIG_HOME/yabridge/config.toml`.
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
#[serde(default)]
|
||||
pub struct Config {
|
||||
/// The installation method to use. We will default to creating copies since that works
|
||||
/// everywhere.
|
||||
@@ -66,6 +67,9 @@ pub struct Config {
|
||||
/// Files/Common/VST3`). We're using an ordered set here out of convenience so we can't get
|
||||
/// duplicates and the config file is always sorted.
|
||||
pub plugin_dirs: BTreeSet<PathBuf>,
|
||||
/// Always skip post-installation setup checks. This can be set temporarily by passing the
|
||||
/// `--no-verify` option to `yabridgectl sync`.
|
||||
pub no_verify: bool,
|
||||
/// The last known combination of Wine and yabridge versions that would work together properly.
|
||||
/// This is mostly to diagnose issues with older Wine versions (such as those in Ubuntu's repos)
|
||||
/// early on.
|
||||
@@ -144,6 +148,18 @@ pub struct YabridgeFiles {
|
||||
pub yabridge_host_exe_so: PathBuf,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Config {
|
||||
method: InstallationMethod::Copy,
|
||||
yabridge_home: None,
|
||||
plugin_dirs: BTreeSet::new(),
|
||||
no_verify: false,
|
||||
last_known_config: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Config {
|
||||
/// Try to read the config file, creating a new default file if necessary. This will fail if the
|
||||
/// file could not be created or if it could not be parsed.
|
||||
@@ -158,12 +174,7 @@ impl Config {
|
||||
.with_context(|| format!("Failed to parse '{}'", path.display()))
|
||||
}
|
||||
None => {
|
||||
let defaults = Config {
|
||||
method: InstallationMethod::Copy,
|
||||
yabridge_home: None,
|
||||
plugin_dirs: BTreeSet::new(),
|
||||
last_known_config: None,
|
||||
};
|
||||
let defaults = Config::default();
|
||||
|
||||
// If no existing config file exists, then write a new config file with default
|
||||
// values
|
||||
|
||||
@@ -116,7 +116,17 @@ fn main() -> Result<()> {
|
||||
"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::with_name("no_verify")
|
||||
.long("no-verify")
|
||||
.about("Always skip post-installation setup checks")
|
||||
.long_about(
|
||||
"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),
|
||||
),
|
||||
)
|
||||
.subcommand(
|
||||
@@ -177,6 +187,7 @@ fn main() -> Result<()> {
|
||||
.ok()
|
||||
.and_then(|path| path.canonicalize().ok()),
|
||||
path_auto: options.is_present("path_auto"),
|
||||
no_verify: options.value_of("no_verify").map(|value| value == "true"),
|
||||
},
|
||||
),
|
||||
("sync", Some(options)) => actions::do_sync(
|
||||
|
||||
Reference in New Issue
Block a user