Optionsschalter vereinheitlicht, .sh-Skripte von überall aufrufbar

- gleiche Aufgabe = gleicher Schalter in allen Programmen:
  -c/--config (Alias --cfg), -i, -o/--outdir, --section, --format,
  -f/--force, -j, -t/--test, -y/--dry, -v
- svgconvert: -o statt -s (Alias --svgfolder), --section statt --format
  für die Sektion (Standard png), --format überschreibt das Bildformat
- webscan: --timeout und --browser nur noch lang (kollidierten mit -t/-b)
- glyphextract: -i nimmt Glyph oder Font, -e extrahiert (statt -f/-t)
- setenv.sh ermittelt das Projektverzeichnis selbst, alle .sh laden es
  relativ zum Skript; extract-font/fonttest reichen weitere Optionen durch
- Hilfetexte korrigiert, doc/README.md: Abschnitt "Gemeinsame Optionen"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Michael Stangl
2026-10-09 09:37:20 +02:00
co-authored by Claude Opus 5.5
parent 28f2bcdb32
commit 6bdaa62a7d
14 changed files with 113 additions and 70 deletions
+21 -14
View File
@@ -123,16 +123,14 @@ def main():
print('ImageMagick not found. Please install it (https://imagemagick.org).')
return None
#set the workpath and the default config
work_path = os.path.expandvars('$PICCREATE_OUT')
if options.svgfolder:
work_path = os.path.expandvars(options.svgfolder)
work_path = os.path.expandvars(options.outdir)
if not os.path.exists(work_path):
print('\"'+ work_path +'\" does not exist. Please give the name of the folder with the svg-files!')
return None
pic_config = {
'width' : '600',
'height' : '200',
'format' : options.format,
'format' : options.format or 'jpg',
'density' : '150',
'background' : 'white',
'folder' : work_path,
@@ -162,7 +160,12 @@ def main():
config = configparser.RawConfigParser()
config.read(config_path, encoding='utf-8')
# fill the config
pic_config = dict(config.items(options.format))
if not config.has_section(options.section):
print('section [' + options.section + '] is missing in ' + config_path)
return None
pic_config = dict(config.items(options.section))
if options.format:
pic_config['format'] = options.format
if options.background:
pic_config['background'] = options.background
elif 'background' in pic_config:
@@ -221,14 +224,17 @@ Read Confg, create wakeup and scale this kind of jiffy box
parser.add_option("-b", "--background", dest="background",
help="set the backgroundcolor. 'none' for transparent",
action='store')
parser.add_option("-c", "--config", dest="config",
help="config file with all data for jobs",
parser.add_option("-c", "--config", "--cfg", dest="config",
help="config file in cfg/ with the picture sizes",
action='store')
parser.add_option("-f", "--force", dest="force", default=False,
help="create the pictures, no matter if they alreads exist",
help="create the pictures, no matter if they already exist",
action='store_true')
parser.add_option("--format", dest="format", default='jpg',
help="format of the picture",
parser.add_option("--section", dest="section", default='png',
help="section in the config file. default is png",
action='store')
parser.add_option("--format", dest="format",
help="jpg or png, overrides the config",
action='store')
parser.add_option("-i", "--infile", dest="infile",
help="csv file with input of names/content",
@@ -239,8 +245,10 @@ Read Confg, create wakeup and scale this kind of jiffy box
parser.add_option("-p", "--progress", dest="progress",
help="print a progression bar",
action='store_true')
parser.add_option("-s", "--svgfolder", dest="svgfolder",
help="path to the folder with the svg-files",
parser.add_option("-o", "--outdir", "--svgfolder", dest="outdir",
default=os.path.expandvars('$PICCREATE_OUT'),
help="folder with the svg files, the pictures are written there too. "
"default is $PICCREATE_OUT",
action='store')
parser.add_option("-t", "--test", dest="test",
help="number of default svg-files that will be created and tested",
@@ -249,8 +257,7 @@ Read Confg, create wakeup and scale this kind of jiffy box
help="print the status of the conversion",
action='store_true')
parser.add_option("-y", "--dry", dest="dry",
help="dont generate images. \
just try if the conversion would success",
help="dont generate images, just try if the conversion would succeed",
action='store_true')
(options, args) = parser.parse_args()