|
|
|
|
Strumenti |
21-01-2021, 13:40 | #1 |
Bannato
Iscritto dal: Mar 2005
Messaggi: 2066
|
[Python] Tutto in uno script o script multipli
Ciao a tutti,
sto scrivendo una piccola utility per modificare i font da riga di comando. In precedenza avevo tanti singoli script, ognuno dei quali faceva una sola cosa. Esempio: Codice:
print-font-info.py --help usage: print-font-info.py [-h] path positional arguments: path path to font or folder containing fonts, e.g. "C:\fonts" or "C:\fonts\font.otf" optional arguments: -h, --help show this help message and exit Ora mi trovo davanti a un dubbio, dovuto dalla mia inesperienza, su come gestire i sottocomandi. La prima opzione che ho valutato è quella di raggruppare tutti i sottocomandi in un unico script: Codice:
ftcli --help Usage: ftcli [OPTIONS] COMMAND [ARGS]... A command line tool to manipulate fonts with FontTools. Options: --help Show this message and exit. Commands: delname Deletes the specified nemerecord(s) from the name table. editcfg Edits the configuration stored in the config.json file editdb Edits the data stored in the data.csv file findreplace Replaces a string with a new one in the specified font(s). ftedit A command line tool to manipulate fonts with fontTools. printftlist Print fonts list printinfo Prints font(s) information: metrics, printnames Prints the names stored in the 'name' table and in the 'CFF'... recalcdb Recalculates values stored in the data.csv file. recalcnames Recalculates namerecords according to the values stored in... resetcfg Creates a new config.json file with following default values. resetdb Reads the fonts values and writes them to the db. setname Sets the specified namerecord(s) in the name table. Codice:
pyftnames --help Usage: pyftnames [OPTIONS] COMMAND [ARGS]... A command line tool to edit names stored in the 'name' and 'CFF' tables. Options: --help Show this message and exit. Commands: delname Deletes the specified nemerecord(s) from the 'name' table. recalc Recalculates namerecords according to the values stored in the... replace Replaces a string in the 'name' table with a new string. setname Sets the specified namerecord(s) in the name table. |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 23:36.