Skip to content

Commit 7eea94a

Browse files
committed
Add --dump-registry option
1 parent a70bf21 commit 7eea94a

File tree

9 files changed

+335
-27
lines changed

9 files changed

+335
-27
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
For more info, [see the custom games document](/docs/help/custom-games.md).
1111
* CLI: The `backup`, `restore`, `cloud upload`, and `cloud download` commands
1212
now support a `--gui` option for graphical dialog prompts.
13+
* CLI: The `backup` and `restore` commands now support a `--dump-registry` option,
14+
which includes the serialized registry content in the output.
15+
This may be useful if you're consuming the `--api` output to back up with another tool,
16+
but don't have a good way to check the registry keys directly.
1317
* Changed:
1418
* When the game list is filtered,
1519
the summary line (e.g., "1 of 10 games") now reflects the filtered totals.

src/cli.rs

+20-2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
152152
differential_limit,
153153
cloud_sync,
154154
no_cloud_sync,
155+
dump_registry,
155156
games,
156157
} => {
157158
let games = parse_games(games);
@@ -353,7 +354,14 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
353354
}
354355

355356
for (name, scan_info, backup_info, decision) in info {
356-
if !reporter.add_game(name, &scan_info, backup_info.as_ref(), &decision, &duplicate_detector) {
357+
if !reporter.add_game(
358+
name,
359+
&scan_info,
360+
backup_info.as_ref(),
361+
&decision,
362+
&duplicate_detector,
363+
dump_registry,
364+
) {
357365
failed = true;
358366
}
359367
}
@@ -369,6 +377,7 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
369377
backup,
370378
cloud_sync,
371379
no_cloud_sync,
380+
dump_registry,
372381
games,
373382
} => {
374383
let games = parse_games(games);
@@ -517,7 +526,14 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
517526
}
518527

519528
for (name, scan_info, backup_info, decision, _) in info {
520-
if !reporter.add_game(name, &scan_info, Some(&backup_info), &decision, &duplicate_detector) {
529+
if !reporter.add_game(
530+
name,
531+
&scan_info,
532+
Some(&backup_info),
533+
&decision,
534+
&duplicate_detector,
535+
dump_registry,
536+
) {
521537
failed = true;
522538
}
523539
}
@@ -928,6 +944,7 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
928944
backup: Default::default(),
929945
cloud_sync: Default::default(),
930946
no_cloud_sync: Default::default(),
947+
dump_registry: Default::default(),
931948
},
932949
no_manifest_update,
933950
try_manifest_update,
@@ -979,6 +996,7 @@ pub fn run(sub: Subcommand, no_manifest_update: bool, try_manifest_update: bool)
979996
differential_limit: Default::default(),
980997
cloud_sync: Default::default(),
981998
no_cloud_sync: Default::default(),
999+
dump_registry: Default::default(),
9821000
},
9831001
no_manifest_update,
9841002
try_manifest_update,

src/cli/parse.rs

+20
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ pub enum Subcommand {
209209
#[clap(long, conflicts_with("cloud_sync"))]
210210
no_cloud_sync: bool,
211211

212+
/// Include the serialized registry content in the output.
213+
/// Only includes the native Windows registry, not Wine.
214+
#[clap(long)]
215+
dump_registry: bool,
216+
212217
/// Only back up these specific games.
213218
/// Alternatively supports stdin (one value per line).
214219
#[clap()]
@@ -260,6 +265,11 @@ pub enum Subcommand {
260265
#[clap(long, conflicts_with("cloud_sync"))]
261266
no_cloud_sync: bool,
262267

268+
/// Include the serialized registry content in the output.
269+
/// Only includes the native Windows registry, not Wine.
270+
#[clap(long)]
271+
dump_registry: bool,
272+
263273
/// Only restore these specific games.
264274
/// Alternatively supports stdin (one value per line).
265275
#[clap()]
@@ -721,6 +731,7 @@ mod tests {
721731
differential_limit: None,
722732
cloud_sync: false,
723733
no_cloud_sync: false,
734+
dump_registry: false,
724735
games: vec![],
725736
}),
726737
},
@@ -754,6 +765,7 @@ mod tests {
754765
"--differential-limit",
755766
"2",
756767
"--cloud-sync",
768+
"--dump-registry",
757769
"game1",
758770
"game2",
759771
],
@@ -776,6 +788,7 @@ mod tests {
776788
differential_limit: Some(2),
777789
cloud_sync: true,
778790
no_cloud_sync: false,
791+
dump_registry: true,
779792
games: vec![s("game1"), s("game2")],
780793
}),
781794
},
@@ -805,6 +818,7 @@ mod tests {
805818
differential_limit: None,
806819
cloud_sync: false,
807820
no_cloud_sync: false,
821+
dump_registry: false,
808822
games: vec![],
809823
}),
810824
},
@@ -842,6 +856,7 @@ mod tests {
842856
differential_limit: None,
843857
cloud_sync: false,
844858
no_cloud_sync: false,
859+
dump_registry: false,
845860
games: vec![],
846861
}),
847862
},
@@ -872,6 +887,7 @@ mod tests {
872887
differential_limit: None,
873888
cloud_sync: false,
874889
no_cloud_sync: false,
890+
dump_registry: false,
875891
games: vec![],
876892
}),
877893
},
@@ -896,6 +912,7 @@ mod tests {
896912
backup: None,
897913
cloud_sync: false,
898914
no_cloud_sync: false,
915+
dump_registry: false,
899916
games: vec![],
900917
}),
901918
},
@@ -918,6 +935,7 @@ mod tests {
918935
"--backup",
919936
".",
920937
"--cloud-sync",
938+
"--dump-registry",
921939
"game1",
922940
"game2",
923941
],
@@ -938,6 +956,7 @@ mod tests {
938956
backup: Some(s(".")),
939957
cloud_sync: true,
940958
no_cloud_sync: false,
959+
dump_registry: true,
941960
games: vec![s("game1"), s("game2")],
942961
}),
943962
},
@@ -978,6 +997,7 @@ mod tests {
978997
backup: None,
979998
cloud_sync: false,
980999
no_cloud_sync: false,
1000+
dump_registry: false,
9811001
games: vec![],
9821002
}),
9831003
},

0 commit comments

Comments
 (0)