From 82f0a8f9f64ca250725a7d934e1dbdcff2ee983d Mon Sep 17 00:00:00 2001
From: Marco Mariani <marco.mariani@nexedi.com>
Date: Mon, 13 May 2013 17:03:33 +0200
Subject: [PATCH] --only and --all are mutually exclusive

---
 documentation/source/slapos.usage.rst | 14 ++------------
 slapos/cli/slapgrid.py                | 28 +++++++++++++++------------
 2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/documentation/source/slapos.usage.rst b/documentation/source/slapos.usage.rst
index 07bf95f22..6bdd809d9 100644
--- a/documentation/source/slapos.usage.rst
+++ b/documentation/source/slapos.usage.rst
@@ -214,18 +214,13 @@ node software
 .. program-output:: python slapos help node software
 
 
-Parameters:
-***********
---only_sr URL                  Only process one specific Software Release that has been supplied on this Computer. If not supplied: do nothing.
---all                          Process all Software Releases, even already installed.
-
 Return values:
 **************
 
 (Among other standard Python return values)
 
 * 0     Everything went fine
-* 1     At least one software hasn't correctly been installed.
+* 1     At least one software was not correctly installed.
 
 
 node instance
@@ -234,18 +229,13 @@ node instance
 .. program-output:: python slapos help node instance
 
 
-Parameters:
-***********
---only_cp PARTITION            Only process one specific Computer Partition, if possible.
---all                          Force processing all Computer Partitions.
-
 Return values:
 **************
 
 (Among other standard Python return values)
 
 * 0    Everything went fine
-* 1    At least one instance hasn't correctly been processed.
+* 1    At least one instance was not correctly processed.
 * 2    At least one promise has failed.
 
 
diff --git a/slapos/cli/slapgrid.py b/slapos/cli/slapgrid.py
index a81a4fc37..1fbf53ee5 100644
--- a/slapos/cli/slapgrid.py
+++ b/slapos/cli/slapgrid.py
@@ -89,12 +89,14 @@ class SoftwareCommand(SlapgridCommand):
 
     def get_parser(self, prog_name):
         ap = super(SoftwareCommand, self).get_parser(prog_name)
-        ap.add_argument('--all', action='store_true',
-                        help='Launch slapgrid to process all Softare Releases.')
-        ap.add_argument('--only-sr', '--only',
-                        help='Force the update of a single software release (can be full URL or MD5 hash), '
-                             'even if is already installed. This option will make all other '
-                             'sofware releases be ignored.')
+
+        only = ap.add_mutually_exclusive_group()
+        only.add_argument('--all', action='store_true',
+                          help='Process all Software Releases, even if already installed.')
+        only.add_argument('--only-sr', '--only',
+                          help='Force the update of a single software release (can be full URL or MD5 hash), '
+                               'even if is already installed. This option will make all other '
+                               'sofware releases be ignored.')
         return ap
 
 
@@ -108,12 +110,14 @@ class InstanceCommand(SlapgridCommand):
 
     def get_parser(self, prog_name):
         ap = super(InstanceCommand, self).get_parser(prog_name)
-        ap.add_argument('--all', action='store_true',
-                        help='Launch slapgrid to process all Computer Partitions.')
-        ap.add_argument('--only-cp', '--only',
-                        help='Update a single or a list of computer partitions '
-                             '(ie.:slappartX, slappartY), '
-                             'this option will make all other computer partitions be ignored.')
+
+        only = ap.add_mutually_exclusive_group()
+        only.add_argument('--all', action='store_true',
+                          help='Process all Computer Partitions.')
+        only.add_argument('--only-cp', '--only',
+                          help='Update a single or a list of computer partitions '
+                               '(ie.:slappartX, slappartY), '
+                               'this option will make all other computer partitions be ignored.')
         return ap
 
 
-- 
2.30.9