From 4c095996cc0156f08bcaccc86d773ceb4aba4d97 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Wed, 4 Mar 2020 02:40:03 +0100 Subject: [PATCH] Accept a path argument on the command line --- src/main.d | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.d b/src/main.d index 1f78b92..3f04879 100644 --- a/src/main.d +++ b/src/main.d @@ -4,10 +4,15 @@ import std.typecons; import gamesdb; import isotoserial; -int main() { +int main(string[] argv) { Unique!GamesDB db = new GamesDB; - string serial = iso_to_serial("/home/michele/deleme/b-mikuex.iso"); + if (argv.length != 2) { + stderr.writeln("Usage: psp2name "); + return 2; + } + + string serial = iso_to_serial(argv[1]); writeln(db.find_by_serial(serial)); return 0; }