Skip to content

Commit

Permalink
Remove deprecated CLI flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Apr 15, 2024
1 parent 210d377 commit fd2c095
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 138 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
This was inconsistent with the `backup` command,
which would simply return empty data if there was nothing to back up.
Now, `restore` and `backups` will also return empty data if there are no backups.
* CLI: Some deprecated flags have been removed from the `backup` command:
`--merge`, `--no-merge`, `--update`, and `--try-update`.
* When synchronizing to the cloud after a backup,
Ludusavi now instructs Rclone to only check paths for games with updated saves.
This improves the cloud sync performance.
Expand Down
24 changes: 0 additions & 24 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@ use crate::{

const PROGRESS_BAR_REFRESH_INTERVAL: Duration = Duration::from_millis(50);

fn warn_backup_deprecations(merge: bool, no_merge: bool, update: bool, try_update: bool) {
if merge {
eprintln!("WARNING: `--merge` is deprecated. Merging is now always enforced.");
}
if no_merge {
eprintln!("WARNING: `--no-merge` is deprecated. Merging is now always enforced.");
}
if update {
eprintln!("WARNING: `--update` is deprecated. Updates are enabled by default, or you can use the `manifest update` command.");
}
if try_update {
eprintln!("WARNING: `--try-update` is deprecated. Use the `--try-manifest-update` global flag.");
}
}

fn negatable_flag(on: bool, off: bool, default: bool) -> bool {
if on {
true
Expand Down Expand Up @@ -146,10 +131,6 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
preview,
path,
force,
merge: x_merge,
no_merge: x_no_merge,
update: x_update,
try_update: x_try_update,
wine_prefix,
api,
sort,
Expand All @@ -162,7 +143,6 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
no_cloud_sync,
games,
} => {
warn_backup_deprecations(x_merge, x_no_merge, x_update, x_try_update);
let games = parse_games(games);

let mut reporter = if api { Reporter::json() } else { Reporter::standard() };
Expand Down Expand Up @@ -979,10 +959,6 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
force: true,
preview: Default::default(),
path: Default::default(),
merge: Default::default(),
no_merge: Default::default(),
update: Default::default(),
try_update: Default::default(),
wine_prefix: Default::default(),
api: Default::default(),
sort: Default::default(),
Expand Down
114 changes: 0 additions & 114 deletions src/cli/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,6 @@ pub enum Subcommand {
#[clap(long)]
force: bool,

/// DEPRECATED: New backups are now always merged into the target folder.
/// This option will be removed in a future version.
#[clap(long)]
merge: bool,

/// DEPRECATED: New backups are now always merged into the target folder.
/// This option will be removed in a future version.
#[clap(long, conflicts_with("merge"))]
no_merge: bool,

/// DEPRECATED: Manifest updates are now enabled by default.
/// This option will be removed in a future version.
#[clap(long)]
update: bool,

/// DEPRECATED: Manifest updates are now enabled by default.
/// This option will be removed in a future version.
#[clap(long, conflicts_with("update"))]
try_update: bool,

/// Extra Wine/Proton prefix to check for saves. This should be a folder
/// with an immediate child folder named "drive_c" (or another letter).
#[clap(long, value_parser = parse_strict_path)]
Expand Down Expand Up @@ -610,10 +590,6 @@ mod tests {
preview: false,
path: None,
force: false,
merge: false,
no_merge: false,
update: false,
try_update: false,
wine_prefix: None,
api: false,
sort: None,
Expand All @@ -640,8 +616,6 @@ mod tests {
"--path",
"tests/backup",
"--force",
"--merge",
"--update",
"--wine-prefix",
"tests/wine-prefix",
"--api",
Expand Down Expand Up @@ -669,10 +643,6 @@ mod tests {
preview: true,
path: Some(StrictPath::new(s("tests/backup"))),
force: true,
merge: true,
no_merge: false,
update: true,
try_update: false,
wine_prefix: Some(StrictPath::new(s("tests/wine-prefix"))),
api: true,
sort: Some(CliSort::Name),
Expand Down Expand Up @@ -701,42 +671,6 @@ mod tests {
preview: false,
path: Some(StrictPath::new(s("tests/fake"))),
force: false,
merge: false,
no_merge: false,
update: false,
try_update: false,
wine_prefix: None,
api: false,
sort: None,
format: None,
compression: None,
compression_level: None,
full_limit: None,
differential_limit: None,
cloud_sync: false,
no_cloud_sync: false,
games: vec![],
}),
},
);
}

#[test]
fn accepts_cli_backup_with_no_merge() {
check_args(
&["ludusavi", "backup", "--no-merge"],
Cli {
config: None,
no_manifest_update: false,
try_manifest_update: false,
sub: Some(Subcommand::Backup {
preview: false,
path: None,
force: false,
merge: false,
no_merge: true,
update: false,
try_update: false,
wine_prefix: None,
api: false,
sort: None,
Expand All @@ -753,46 +687,6 @@ mod tests {
);
}

#[test]
fn accepts_cli_backup_with_try_update() {
check_args(
&["ludusavi", "backup", "--try-update"],
Cli {
config: None,
no_manifest_update: false,
try_manifest_update: false,
sub: Some(Subcommand::Backup {
preview: false,
path: None,
force: false,
merge: false,
no_merge: false,
update: false,
try_update: true,
wine_prefix: None,
api: false,
sort: None,
format: None,
compression: None,
compression_level: None,
full_limit: None,
differential_limit: None,
cloud_sync: false,
no_cloud_sync: false,
games: vec![],
}),
},
);
}

#[test]
fn rejects_cli_backup_with_update_and_try_update() {
check_args_err(
&["ludusavi", "backup", "--update", "--try-update"],
clap::error::ErrorKind::ArgumentConflict,
);
}

#[test]
fn accepts_cli_backup_with_sort_variants() {
let cases = [
Expand All @@ -813,10 +707,6 @@ mod tests {
preview: false,
path: None,
force: false,
merge: false,
no_merge: false,
update: false,
try_update: false,
wine_prefix: None,
api: false,
sort: Some(sort),
Expand Down Expand Up @@ -846,10 +736,6 @@ mod tests {
preview: false,
path: None,
force: false,
merge: false,
no_merge: false,
update: false,
try_update: false,
wine_prefix: None,
api: false,
sort: None,
Expand Down

0 comments on commit fd2c095

Please sign in to comment.