-
Notifications
You must be signed in to change notification settings - Fork 1
Sflags
maxlandon edited this page Jan 8, 2023
·
3 revisions
This page is intended for users of octago/sflags.
The flags library is actually almost forked from sflags, and the entire code for generating command flags (not positional arguments for now) is exactly the same (with some fixes). Users should thus expect mostly the same behavior.
However, there are a few differences, listed below:
- The
flags.OptFuncs
now include a newflags.ParseAll()
, to indicate to the generator that the struct fields, regardless of them being tagged or not, have to be parsed into cobra command flags. This is because by default, the flags library will ignore all struct fields that are not tagged either as commands, positionals, flags or groups of them. - The
validator/govalidator
package is still provided and compatible with this library. I added thevalidator
code usinggit.luolix.top/go-playground/validator
because the former is not maintained anymore, and most of its peculiar features are not needed. Additionally,go-validator
also enables to pass custom validations, error messages, and also has a long list of builtin validations.-
github.com/reeflective/flags/validator/govalidator
is the legacy one. -
github.com/reeflective/flags/validator
is the new one.
-