Skip to content

Commit 61d99a4

Browse files
authored
Merge pull request #328 from brianquinlan/patch-2
Add documentation for `DEFINE_enum_class`
2 parents 0095ebc + d3775d7 commit 61d99a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/python/guides/flags.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ flags have other arguments, which are described with the flag.
7171
takes optional arguments `lower_bound` and `upper_bound` as for floats.
7272
* `DEFINE_enum`: takes a list of strings that represents legal values. If the
7373
command-line value is not in this list, it raises a flag error; otherwise,
74-
it assigns to `FLAGS.flag` as a string.
75-
* `DEFINE_list`: Takes a comma-separated list of strings on the command line
74+
it assigns to `FLAGS.flag` as a string. If possible, use `DEFINE_enum_class`
75+
instead.
76+
* `DEFINE_enum_class`: takes an `enum.Enum` that represents legal values. If the
77+
command-line value is not a member of the enumeration, it raises a flag
78+
error; otherwise, it assigns the value of the member to `FLAGS.flag`.
79+
* `DEFINE_list`: takes a comma-separated list of strings on the command line
7680
and stores them in a Python list object.
7781
* `DEFINE_spaceseplist`: Takes a space-separated list of strings on the
7882
commandline and stores them in a Python list object. For example:

0 commit comments

Comments
 (0)