Documentation ¶
Overview ¶
slice_flags is a tool to instantly implement a flag.Value called <Something>SliceFlag, which contains a slice of <Something>Flags, an accessor called <Something>Slice, and a test to ensure that the SliceFlag parses and Preprocesses correctly if necessary.
It's intended for use in cmd/bytemark/app/flags - see slice_flags.go in that package for the go:generate directives.
example usage: to add a SliceFlag for some NewFlag which uses Preprocess and for which "blah" is a value value: go run ./gen/slice_flags/slice_flags.go -preprocesser -o new_flag.go --example-input "blah" New
For the generated test it is assumed that your original Flag, when Set with some string will return the same string when String() is called. If this is not the case, we need to modify this code and template_test.go.tmpl to accept an example output as well as the example input.
If, for whatever reason, it is useful to reuse this code with different templates, the -t and -tt options specify the template for the SliceFlag and the test for the SliceFlag, respectively.