Skip to content

Commit

Permalink
Add --dump-registry option
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Dec 31, 2024
1 parent a70bf21 commit 7eea94a
Show file tree
Hide file tree
Showing 9 changed files with 335 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
For more info, [see the custom games document](/docs/help/custom-games.md).
* CLI: The `backup`, `restore`, `cloud upload`, and `cloud download` commands
now support a `--gui` option for graphical dialog prompts.
* CLI: The `backup` and `restore` commands now support a `--dump-registry` option,
which includes the serialized registry content in the output.
This may be useful if you're consuming the `--api` output to back up with another tool,
but don't have a good way to check the registry keys directly.
* Changed:
* When the game list is filtered,
the summary line (e.g., "1 of 10 games") now reflects the filtered totals.
Expand Down
22 changes: 20 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
differential_limit,
cloud_sync,
no_cloud_sync,
dump_registry,
games,
} => {
let games = parse_games(games);
Expand Down Expand Up @@ -353,7 +354,14 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
}

for (name, scan_info, backup_info, decision) in info {
if !reporter.add_game(name, &scan_info, backup_info.as_ref(), &decision, &duplicate_detector) {
if !reporter.add_game(
name,
&scan_info,
backup_info.as_ref(),
&decision,
&duplicate_detector,
dump_registry,
) {
failed = true;
}
}
Expand All @@ -369,6 +377,7 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
backup,
cloud_sync,
no_cloud_sync,
dump_registry,
games,
} => {
let games = parse_games(games);
Expand Down Expand Up @@ -517,7 +526,14 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
}

for (name, scan_info, backup_info, decision, _) in info {
if !reporter.add_game(name, &scan_info, Some(&backup_info), &decision, &duplicate_detector) {
if !reporter.add_game(
name,
&scan_info,
Some(&backup_info),
&decision,
&duplicate_detector,
dump_registry,
) {
failed = true;
}
}
Expand Down Expand Up @@ -928,6 +944,7 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
backup: Default::default(),
cloud_sync: Default::default(),
no_cloud_sync: Default::default(),
dump_registry: Default::default(),
},
no_manifest_update,
try_manifest_update,
Expand Down Expand Up @@ -979,6 +996,7 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
differential_limit: Default::default(),
cloud_sync: Default::default(),
no_cloud_sync: Default::default(),
dump_registry: Default::default(),
},
no_manifest_update,
try_manifest_update,
Expand Down
20 changes: 20 additions & 0 deletions src/cli/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ pub enum Subcommand {
#[clap(long, conflicts_with("cloud_sync"))]
no_cloud_sync: bool,

/// Include the serialized registry content in the output.
/// Only includes the native Windows registry, not Wine.
#[clap(long)]
dump_registry: bool,

/// Only back up these specific games.
/// Alternatively supports stdin (one value per line).
#[clap()]
Expand Down Expand Up @@ -260,6 +265,11 @@ pub enum Subcommand {
#[clap(long, conflicts_with("cloud_sync"))]
no_cloud_sync: bool,

/// Include the serialized registry content in the output.
/// Only includes the native Windows registry, not Wine.
#[clap(long)]
dump_registry: bool,

/// Only restore these specific games.
/// Alternatively supports stdin (one value per line).
#[clap()]
Expand Down Expand Up @@ -721,6 +731,7 @@ mod tests {
differential_limit: None,
cloud_sync: false,
no_cloud_sync: false,
dump_registry: false,
games: vec![],
}),
},
Expand Down Expand Up @@ -754,6 +765,7 @@ mod tests {
"--differential-limit",
"2",
"--cloud-sync",
"--dump-registry",
"game1",
"game2",
],
Expand All @@ -776,6 +788,7 @@ mod tests {
differential_limit: Some(2),
cloud_sync: true,
no_cloud_sync: false,
dump_registry: true,
games: vec![s("game1"), s("game2")],
}),
},
Expand Down Expand Up @@ -805,6 +818,7 @@ mod tests {
differential_limit: None,
cloud_sync: false,
no_cloud_sync: false,
dump_registry: false,
games: vec![],
}),
},
Expand Down Expand Up @@ -842,6 +856,7 @@ mod tests {
differential_limit: None,
cloud_sync: false,
no_cloud_sync: false,
dump_registry: false,
games: vec![],
}),
},
Expand Down Expand Up @@ -872,6 +887,7 @@ mod tests {
differential_limit: None,
cloud_sync: false,
no_cloud_sync: false,
dump_registry: false,
games: vec![],
}),
},
Expand All @@ -896,6 +912,7 @@ mod tests {
backup: None,
cloud_sync: false,
no_cloud_sync: false,
dump_registry: false,
games: vec![],
}),
},
Expand All @@ -918,6 +935,7 @@ mod tests {
"--backup",
".",
"--cloud-sync",
"--dump-registry",
"game1",
"game2",
],
Expand All @@ -938,6 +956,7 @@ mod tests {
backup: Some(s(".")),
cloud_sync: true,
no_cloud_sync: false,
dump_registry: true,
games: vec![s("game1"), s("game2")],
}),
},
Expand Down Expand Up @@ -978,6 +997,7 @@ mod tests {
backup: None,
cloud_sync: false,
no_cloud_sync: false,
dump_registry: false,
games: vec![],
}),
},
Expand Down
Loading

0 comments on commit 7eea94a

Please sign in to comment.