better subcommand finding

pull/23100/head
elpekenin 2024-06-05 15:58:29 +02:00
parent a4cb7082d9
commit 4550e01d74
1 changed files with 1 additions and 2 deletions

View File

@ -1,7 +1,6 @@
"""This script automates the conversion of font files into a format QMK firmware understands.
"""
import sys
from io import BytesIO
from qmk.path import normpath
from qmk.painter_qff import _generate_font_glyphs_list, QFFFont
@ -58,7 +57,7 @@ def _image_to_qff(cli, input_):
return
# Work out the text substitutions for rendering the output data
subcommand = sys.argv[1] # hacky way of telling apart painter-convert-font and painter-convert-font-image
subcommand = cli.args.entrypoint.__name__.replace('_', '-') # tell apart painter-convert-font and painter-convert-font-image
args_str = " ".join((f"--{arg} {getattr(cli.args, arg.replace('-', '_'))}" for arg in ["input", "output", "no-ascii", "unicode-glyphs", "format", "no-rle"]))
command = f"qmk {subcommand} {args_str}"
metadata = {"glyphs": _generate_font_glyphs_list(not cli.args.no_ascii, cli.args.unicode_glyphs)}