refactor: clearer args

This commit is contained in:
klemek committed 2026-11-07 16:15:57 +01:00
1 parent 1dd2bce5c4
commit 22d2952334
2 files changed
+31 -17

No files matched your search

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