With flag
package, we can specify some command line parameters like this:
import "flag"
fun main() {
from := flag.String("from", "", "the path to be copied")
to := flag.String("to", "", "where the data copied to")
ldb := flag.String("db", "./ldb", "the database path used during copy")
pwd := flag.String("pwd", "", "password to encrypt your data, default no encryption on your data"
flag.Parse()
...
}
When use -h
for help, the printed message seems not the order I provided:
-db string
the database path used during copy (default "./ldb")
-from string
the path to be copied
-pwd string
password to encrypt your data, default no encryption on your data
-to string
where the data copy to
the order not intuitive, is there other options to tell Golang: Don't sort my parameter's automatically! ?