From 4eefc2e47c348fcfbc531cdc95b91e6da2468001 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Thu, 4 Jan 2024 15:37:09 +0100
Subject: [PATCH] test/DumpDatabase: add "URI" parameter

---
 test/DumpDatabase.cxx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx
index bd7c5409c..68a08c55f 100644
--- a/test/DumpDatabase.cxx
+++ b/test/DumpDatabase.cxx
@@ -83,13 +83,15 @@ DumpPlaylist(const PlaylistInfo &playlist, const LightDirectory &directory)
 int
 main(int argc, char **argv)
 try {
-	if (argc != 2) {
-		fmt::print(stderr, "Usage: DumpDatabase CONFIG\n");
+	if (argc < 2 || argc > 3) {
+		fmt::print(stderr, "Usage: DumpDatabase CONFIG [URI]\n");
 		return EXIT_FAILURE;
 	}
 
 	const FromNarrowPath config_path = argv[1];
 
+	const char *uri = argc >= 3 ? argv[2] : "";
+
 	/* initialize MPD */
 
 	GlobalInit init;
@@ -111,7 +113,7 @@ try {
 
 	AtScopeExit(&db) { db->Close(); };
 
-	const DatabaseSelection selection("", true);
+	const DatabaseSelection selection(uri, true);
 
 	db->Visit(selection, DumpDirectory, DumpSong, DumpPlaylist);