From 274687d85279b95140e35104eba593309ab7980a Mon Sep 17 00:00:00 2001
From: Rui Chen <chenrui.momo@gmail.com>
Date: Tue, 17 Jan 2017 17:09:57 +0800
Subject: [PATCH] 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
---
 doc/source/command-options.rst | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/doc/source/command-options.rst b/doc/source/command-options.rst
index c850b000cf..faa82bee21 100644
--- a/doc/source/command-options.rst
+++ b/doc/source/command-options.rst
@@ -153,6 +153,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>',
@@ -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: