From: Keith Packard Date: Wed, 12 Feb 2025 05:42:24 +0000 (-0800) Subject: Add --warn-only flag to partslist-vendor X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=aae039940a392944877ee84d844180cc44469716;p=hw%2Faltusmetrum Add --warn-only flag to partslist-vendor Signed-off-by: Keith Packard --- diff --git a/bin/partslist-vendor b/bin/partslist-vendor index 19f4d55..5a19926 100755 --- a/bin/partslist-vendor +++ b/bin/partslist-vendor @@ -17,6 +17,7 @@ file output = stdout; int argi; int lineno = 0; bool saw_error = false; +bool warn_only = false; void fatal(string format, poly args ...) { @@ -27,7 +28,8 @@ void fatal(string format, poly args ...) void error(string format, poly args ...) { File::fprintf(stderr, format, args...); - saw_error = true; + if (!warn_only) + saw_error = true; } string[*] read_line(file f) { @@ -203,7 +205,7 @@ void process_jlcpcb(string[string] entry) return; } string part_number; - if (hash_test(entry, "jlcpcb_part_number")) { + if (hash_test(entry, "jlcpcb_part_number") && entry["jlcpcb_part_number"] != "unknown") { part_number = entry["jlcpcb_part_number"]; } else { error("Component (%s, %s, %s) has no JLCPCB Part #\n", @@ -302,6 +304,10 @@ ParseArgs::argdesc argd = { .abbr = 'm', .name = "mfg", .desc = "Display manufacturer part number"}, + { .var = { .arg_flag = &warn_only }, + .abbr = 'w', + .name = "warn-only", + .desc = "Missing values are warnings rather than errors"}, { .var = { .arg_string = &vendor_list }, .abbr = 'v', .name = "vendor",