È possibile personalizzare il pacchetto flag
di Go in modo da stampare una stringa di utilizzo personalizzata? Ho un'applicazione con uscita in correnteL'uso della stampa del pacchetto `flag` di Can Go?
Usage of ./mysqlcsvdump:
-compress-file=false: whether compress connection or not
-hostname="": database host
-outdir="": where output will be stored
-password="": database password
-port=3306: database port
-single-transaction=true: whether to wrap everything in a transaction or not.
-skip-header=false: whether column header should be included or not
-user="root": database user
e preferirei avere qualcosa di simile
Usage: ./mysqlcsvdump [options] [table1 table2 ... tableN]
Parameters:
-compress-file=false: whether compress connection or not
-hostname="": database host
-outdir="": where output will be stored
-password="": database password
-port=3306: database port
-single-transaction=true: whether to wrap everything in a transaction or not.
-skip-header=false: whether column header should be included or not
-user="root": database user
Personalmente mi piace questo pacchetto modo più che le bandiere standard, è molto più robusto e più in linea con altre lingue: https://github.com/jessevdk/go-flags. Dovresti fare un tentativo. –
Plug vergognoso: e un altro pacchetto "process line processor" per Go: https://github.com/speedata/optionparser – topskip
@topskip l'abbondanza di grandi parser alternativi da riga di comando in Go, evidenzia quanto manca il parser standard, purtroppo. –