mirror of https://github.com/dmarkham/enumer.git
Merge pull request #95 from dmarkham/samiam2013/readme-revision
Note in the readme and flag that trimprefix accepts lists
This commit is contained in:
commit
bcbe6173c3
|
@ -7,9 +7,9 @@ This was again forked here as (https://github.com/dmarkham/enumer) picking up wh
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ ./enumer --help
|
$ enumer --help
|
||||||
Enumer is a tool to generate Go code that adds useful methods to Go enums (constants with a specific type).
|
Enumer is a tool to generate Go code that adds useful methods to Go enums (constants with a specific type).
|
||||||
Usage of ./enumer:
|
Usage of enumer:
|
||||||
Enumer [flags] -type T [directory]
|
Enumer [flags] -type T [directory]
|
||||||
Enumer [flags] -type T files... # Must be a single package
|
Enumer [flags] -type T files... # Must be a single package
|
||||||
For more information, see:
|
For more information, see:
|
||||||
|
@ -34,7 +34,7 @@ Flags:
|
||||||
-transform string
|
-transform string
|
||||||
enum item name transformation method. Default: noop (default "noop")
|
enum item name transformation method. Default: noop (default "noop")
|
||||||
-trimprefix string
|
-trimprefix string
|
||||||
transform each item name by removing a prefix. Default: ""
|
transform each item name by removing a prefix or comma separated list of prefixes. Default: ""
|
||||||
-type string
|
-type string
|
||||||
comma-separated list of type names; must be set
|
comma-separated list of type names; must be set
|
||||||
-values
|
-values
|
||||||
|
@ -208,7 +208,8 @@ Possible transform values are listed above in the [transformers](#transformers)
|
||||||
The default value for `transform` flag is `noop` which means no transformation will be performed.
|
The default value for `transform` flag is `noop` which means no transformation will be performed.
|
||||||
|
|
||||||
If a prefix is provided via the `trimprefix` flag, it will be trimmed from the start of each name (before
|
If a prefix is provided via the `trimprefix` flag, it will be trimmed from the start of each name (before
|
||||||
it is transformed). If a name doesn't have the prefix it will be passed unchanged.
|
it is transformed). You can trim multiple prefixes by passing a comma separated list.
|
||||||
|
If a name doesn't have the prefix it will be passed unchanged.
|
||||||
|
|
||||||
If a prefix is provided via the `addprefix` flag, it will be added to the start of each name (after trimming and after transforming).
|
If a prefix is provided via the `addprefix` flag, it will be added to the start of each name (after trimming and after transforming).
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ var (
|
||||||
altValuesFunc = flag.Bool("values", false, "if true, alternative string values method will be generated. Default: false")
|
altValuesFunc = flag.Bool("values", false, "if true, alternative string values method will be generated. Default: false")
|
||||||
output = flag.String("output", "", "output file name; default srcdir/<type>_string.go")
|
output = flag.String("output", "", "output file name; default srcdir/<type>_string.go")
|
||||||
transformMethod = flag.String("transform", "noop", "enum item name transformation method. Default: noop")
|
transformMethod = flag.String("transform", "noop", "enum item name transformation method. Default: noop")
|
||||||
trimPrefix = flag.String("trimprefix", "", "transform each item name by removing a prefix. Default: \"\"")
|
trimPrefix = flag.String("trimprefix", "", "transform each item name by removing a prefix or comma separated list of prefixes. Default: \"\"")
|
||||||
addPrefix = flag.String("addprefix", "", "transform each item name by adding a prefix. Default: \"\"")
|
addPrefix = flag.String("addprefix", "", "transform each item name by adding a prefix. Default: \"\"")
|
||||||
linecomment = flag.Bool("linecomment", false, "use line comment text as printed text when present")
|
linecomment = flag.Bool("linecomment", false, "use line comment text as printed text when present")
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue