Skip to content

Commit e8191e4

Browse files
committed
tools/clean-svg: make the tablet name argument optional
If we're passing in a .tablet file we don't need the tablet name argument
1 parent 7070531 commit e8191e4

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ jobs:
212212
run: |
213213
for tabletfile in data/*.tablet; do
214214
echo "Checking $tabletfile"
215-
./tools/clean_svg.py --ignore-missing "$tabletfile" ""
215+
./tools/clean_svg.py --ignore-missing "$tabletfile"
216216
done
217217
218218
###

tools/clean_svg.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,17 @@ def clean_svg(root, tabletname):
317317
default=False,
318318
help="Ignore .tablet files without a Layout",
319319
)
320-
parser.add_argument("filename", type=str, help="SVG file to clean", metavar="FILE")
320+
parser.add_argument(
321+
"filename",
322+
type=str,
323+
help="SVG file to clean or .tablet file with a Layout=xyz.svg line",
324+
metavar="FILE",
325+
)
321326
parser.add_argument(
322327
"tabletname",
323328
type=str,
324-
help="The name of the tablet",
329+
nargs="?",
330+
help="The name of the tablet, can be omitted if FILE is a .tablet file",
325331
metavar="TABLET_NAME",
326332
)
327333
args = parser.parse_args()
@@ -345,6 +351,8 @@ def clean_svg(root, tabletname):
345351
sys.exit(0 if args.ignore_missing else 77)
346352
svgfile = Path(args.filename).parent / "layouts" / svgname
347353
tabletname = config["Device"]["Name"]
354+
else:
355+
assert tabletname, "Argument TABLET_NAME must be provided for SVG files"
348356

349357
ET.register_namespace("", NAMESPACE)
350358
try:

0 commit comments

Comments
 (0)