]> git.gag.com Git - hw/altusmetrum/commitdiff
Detect input file format for fillparts commands
authorKeith Packard <keithp@keithp.com>
Sun, 22 Jun 2025 21:39:59 +0000 (14:39 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 22 Jun 2025 21:42:09 +0000 (14:42 -0700)
Allow either .csv, .tab or .ods files for these operations.

Signed-off-by: Keith Packard <keithp@keithp.com>
bin/fillpartscsv.py
bin/fillpartslist.py

index e502bae8177748891b4350ef5ae8d72856e3e5ef..0b85cfcdfee9ec772d69e5713445d76f246bbff9 100755 (executable)
@@ -38,8 +38,7 @@ def main():
     try:
         if args.input:
             parts_name = args.input
-            with open(args.input) as input:
-                my_parts = parts.Parts(csv_file=input)
+            my_parts = parts.Parts(autofile=parts_name)
         else:
             parts_name = "<stdin>"
             my_parts = parts.Parts(csv_file=sys.stdin)
index 119f663904974c958709c839b7bd7bc8f115cc2e..6f991fdbcfa7cc9c0b819523b9c008e00a15c4c8 100755 (executable)
@@ -38,8 +38,7 @@ def main():
     try:
         if args.input:
             parts_name = args.input
-            with open(args.input) as input:
-                my_parts = parts.Parts(tab_file=input)
+            my_parts = parts.Parts(autofile=parts_name)
         else:
             parts_name = "<stdin>"
             my_parts = parts.Parts(tab_file=sys.stdin)