@@ -153,6 +153,15 @@ An example parser declaration for `set` action:
153153
154154.. code-block :: python
155155
156+ parser.add_argument(
157+ ' --no-example-property' ,
158+ dest = ' no_example_property' ,
159+ action = ' store_true' ,
160+ help = _(' Remove all example properties for this <resource> '
161+ ' (specify both --no-example-property and --example-property'
162+ ' to remove the current properties before setting'
163+ ' new properties.)' ),
164+ )
156165 parser.add_argument(
157166 ' --example-property' ,
158167 metavar = ' <example-property>' ,
@@ -161,26 +170,21 @@ An example parser declaration for `set` action:
161170 help = _(' Example property for this <resource> '
162171 ' (repeat option to set multiple properties)' ),
163172 )
164- parser.add_argument(
165- ' --no-example-property' ,
166- dest = ' no_example_property' ,
167- action = ' store_true' ,
168- help = _(' Remove all example properties for this <resource> '
169- ' (specify both --example-property and --no-example-property'
170- ' to overwrite the current example properties)' ),
171- )
173+
174+ Please make `--no-example-property ` be shown in front of `--example-property `
175+ in the help, like above, that help make users aware of the processing order.
172176
173177An example handler in `take_action() ` for `set ` action:
174178
175179.. code-block :: python
176180
177- if parsed_args.example_property and parsed_args.no_example_property :
181+ if parsed_args.no_example_property and parsed_args.example_property :
178182 kwargs[' example_property' ] = parsed_args.example_property
183+ elif parsed_args.no_example_property:
184+ kwargs[' example_property' ] = []
179185 elif parsed_args.example_property:
180186 kwargs[' example_property' ] = \
181187 resource_example_property + parsed_args.example_property
182- elif parsed_args.no_example_property:
183- kwargs[' example_property' ] = []
184188
185189 An example parser declaration for `unset ` action:
186190
0 commit comments