refactor: clearer args

This commit is contained in:
2026-11-07 16:15:57 +01:00
parent 1dd2bce5c4
commit 22d2952334
2 changed files with 31 additions and 17 deletions
+12 -13
View File
@@ -7,26 +7,25 @@
## Usage
```txt
usage: glsl-glyphs [-h] -i SOURCE_IMAGE_PATH [-n TARGET_NAME] -o TARGET_PATH [--glyph-names SOURCE_NAMES_PATH] [-s SOURCE_SETS_PATH]
[--functions | --no-functions] [--verbose | --no-verbose] [--quiet | --no-quiet]
usage: glsl-glyphs [-h] -i INPUT_FILE [-n NAME] -o OUTPUT_FILE [-g NAMES_FILE] [-s SETS_FILE] [-f | --functions | --no-functions]
[-v | --verbose | --no-verbose] [-q | --quiet | --no-quiet]
options:
-h, --help show this help message and exit
-i, --input SOURCE_IMAGE_PATH
-i, --input INPUT_FILE
png 8x8 glyph map
-n, --name TARGET_NAME
target derived name for GLSL constants and functions (default: glyph)
-o, --output TARGET_PATH
-n, --name NAME target derived name for GLSL constants and functions (default: glyph)
-o, --output OUTPUT_FILE
output glsl file
--glyph-names SOURCE_NAMES_PATH
-g, --glyph-names NAMES_FILE
glyphs names, one line each
-s, --sets SOURCE_SETS_PATH
defined sets in CSV: index,length,name
--functions, --no-functions
add GLSL functions to output (default)
--verbose, --no-verbose
-s, --sets SETS_FILE defined sets in CSV: index,length,name
-f, --functions, --no-functions
add GLSL functions to output
-v, --verbose, --no-verbose
more verbose logging
--quiet, --no-quiet disable logging
-q, --quiet, --no-quiet
disable logging
```
## More info about included resources
+19 -4
View File
@@ -12,7 +12,7 @@ class Parameters:
source_sets_path: str | None = None
target_path: str | None = None
target_name: str = "glyph"
functions: bool = True
functions: bool = False
verbose: bool = False
quiet: bool = False
@@ -31,41 +31,56 @@ def parse_parameters(args: typing.Sequence[str]) -> Parameters:
"-i",
"--input",
required=True,
metavar="INPUT_FILE",
dest="source_image_path",
help="png 8x8 glyph map",
)
parser.add_argument(
"-n",
"--name",
metavar="NAME",
dest="target_name",
help="target derived name for GLSL constants and functions (default: glyph)",
default=default_values.target_name,
)
parser.add_argument(
"-o", "--output", required=True, dest="target_path", help="output glsl file"
"-o",
"--output",
metavar="OUTPUT_FILE",
required=True,
dest="target_path",
help="output glsl file",
)
parser.add_argument(
"--glyph-names", dest="source_names_path", help="glyphs names, one line each"
"-g",
"--glyph-names",
metavar="NAMES_FILE",
dest="source_names_path",
help="glyphs names, one line each",
)
parser.add_argument(
"-s",
"--sets",
metavar="SETS_FILE",
dest="source_sets_path",
help="defined sets in CSV: index,length,name",
)
parser.add_argument(
"-f",
"--functions",
action=argparse.BooleanOptionalAction,
default=default_values.functions,
help="add GLSL functions to output (default)",
help="add GLSL functions to output",
)
parser.add_argument(
"-v",
"--verbose",
action=argparse.BooleanOptionalAction,
default=default_values.verbose,
help="more verbose logging",
)
parser.add_argument(
"-q",
"--quiet",
action=argparse.BooleanOptionalAction,
default=default_values.quiet,