summaryrefslogtreecommitdiff
path: root/doc/source
diff options
context:
space:
mode:
authorRui Chen <chenrui.momo@gmail.com>2017-01-17 17:09:57 +0800
committerRui Chen <chenrui.momo@gmail.com>2017-01-22 06:30:35 +0000
commit274687d85279b95140e35104eba593309ab7980a (patch)
treeeb043b7907b9e7a5612d8e5e0c063b324066adcb /doc/source
parent607f31d3db924517c18fd192239e5ef5963e17f3 (diff)
downloadpython-openstackclient-274687d85279b95140e35104eba593309ab7980a.tar.gz
Update devref about "--no-property"
Update the example about "--no-property" and "--property" to make help message order more reasonable, that help make users aware of the processing order, and update the help details when both "--no-property" and "--property" appear in the same command. Change-Id: I998cdaf2f8c881dce219581ff328a639e8e358ee Implements: blueprint allow-overwrite-set-options
Diffstat (limited to 'doc/source')
-rw-r--r--doc/source/command-options.rst26
1 files changed, 15 insertions, 11 deletions
diff --git a/doc/source/command-options.rst b/doc/source/command-options.rst
index c850b000..faa82bee 100644
--- a/doc/source/command-options.rst
+++ b/doc/source/command-options.rst
@@ -154,6 +154,15 @@ An example parser declaration for `set` action:
.. code-block:: python
parser.add_argument(
+ '--no-example-property',
+ dest='no_example_property',
+ action='store_true',
+ help=_('Remove all example properties for this <resource> '
+ '(specify both --no-example-property and --example-property'
+ ' to remove the current properties before setting'
+ ' new properties.)'),
+ )
+ parser.add_argument(
'--example-property',
metavar='<example-property>',
dest='example_property',
@@ -161,26 +170,21 @@ An example parser declaration for `set` action:
help=_('Example property for this <resource> '
'(repeat option to set multiple properties)'),
)
- parser.add_argument(
- '--no-example-property',
- dest='no_example_property',
- action='store_true',
- help=_('Remove all example properties for this <resource> '
- '(specify both --example-property and --no-example-property'
- ' to overwrite the current example properties)'),
- )
+
+Please make `--no-example-property` be shown in front of `--example-property`
+in the help, like above, that help make users aware of the processing order.
An example handler in `take_action()` for `set` action:
.. code-block:: python
- if parsed_args.example_property and parsed_args.no_example_property:
+ if parsed_args.no_example_property and parsed_args.example_property:
kwargs['example_property'] = parsed_args.example_property
+ elif parsed_args.no_example_property:
+ kwargs['example_property'] = []
elif parsed_args.example_property:
kwargs['example_property'] = \
resource_example_property + parsed_args.example_property
- elif parsed_args.no_example_property:
- kwargs['example_property'] = []
An example parser declaration for `unset` action: