python/samples/caps                               |  16 +++++++++++++---
 python/samples/caps-inheritance-impl              |  16 +++++++++++++---
 python/samples/imm-listener                       |  11 ++++++++++-
 python/samples/imm-listener-inheritance-impl      |  11 ++++++++++-
 python/samples/interface-handler                  |   9 ++++++++-
 python/samples/interface-handler-inheritance-impl |   9 ++++++++-
 python/samples/ping-pong                          |  11 +++++++++--
 python/samples/ping-pong-inheritance-impl         |  11 +++++++++--
 python/samples/time-reporter                      |  11 ++++++++++-
 python/samples/time-reporter-inheritance-impl     |  10 +++++++++-
 python/samples/tones                              |  17 +++++++++++++++--
 python/samples/tones-inheritance-impl             |  17 +++++++++++++++--
 python/samples/users                              |  13 ++++++++++---
 python/samples/users-inheritance-impl             |  13 ++++++++++---
 14 files changed, 149 insertions(+), 26 deletions(-)


Add usage examples to the help text printed when the sample applications are 
executed with --help.

diff --git a/python/samples/caps b/python/samples/caps
--- a/python/samples/caps
+++ b/python/samples/caps
@@ -34,9 +34,19 @@ if __name__ == "__main__":
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Validates that the lowerCaps and upperCaps attributes'
-        'of instances of the CapsSample class can only contain'
-        'lower case and upper case text respectively.')
+        description='''Validates that the lowerCaps and upperCaps attributes
+of instances of the CapsSample class can only contain
+lower case and upper case text respectively.
+
+Use like this:
+$ caps &
+
+$ immcfg -c CapsSample capsId=<RDN>
+
+$ immcfg -a upperCaps=ABC capsId=<RDN>  (allowed)
+
+$ immcfg -a lowerCaps=Abc capsId=<RDN>  (not allowed)
+''', formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/caps-inheritance-impl 
b/python/samples/caps-inheritance-impl
--- a/python/samples/caps-inheritance-impl
+++ b/python/samples/caps-inheritance-impl
@@ -45,9 +45,19 @@ if __name__ == "__main__":
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Validates that the lowerCaps and upperCaps attributes'
-        'of instances of the CapsSample class can only contain'
-        'lower case and upper case text respectively.')
+        description='''Validates that the lowerCaps and upperCaps attributes
+of instances of the CapsSample class can only contain
+lower case and upper case text respectively.
+
+Use like this:
+$ caps-inheritance-impl &
+
+$ immcfg -c CapsSample capsId=<RDN>
+
+$ immcfg -a upperCaps=ABC capsId=<RDN>  (allowed)
+
+$ immcfg -a lowerCaps=Abc capsId=<RDN>  (not allowed)
+''', formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/imm-listener b/python/samples/imm-listener
--- a/python/samples/imm-listener
+++ b/python/samples/imm-listener
@@ -58,7 +58,16 @@ if __name__ == "__main__":
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Listens to changes to objects of the given classes')
+        description='''Listens to changes to objects of the given classes
+Use like this:
+
+$ imm-listener SampleClass1
+
+or, to listen for changes to all configuration classes:
+
+$ imm-listener --all
+''', formatter_class=argparse.RawTextHelpFormatter)
+
     parser.add_argument('classes', type=str, nargs='*', 
                         help='space-separated list of class names')
     parser.add_argument('--all', help='listens to changes to all classes',
diff --git a/python/samples/imm-listener-inheritance-impl 
b/python/samples/imm-listener-inheritance-impl
--- a/python/samples/imm-listener-inheritance-impl
+++ b/python/samples/imm-listener-inheritance-impl
@@ -105,7 +105,16 @@ if __name__ == "__main__":
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Listens to changes to objects of the given classes')
+        description='''Listens to changes to objects of the given classes
+Use like this:
+
+$ imm-listener-inheritance-impl SampleClass1
+
+or, to listen for changes to all configuration classes:
+
+$ imm-listener-inheritance-impl --all
+''', formatter_class=argparse.RawTextHelpFormatter)
+
     parser.add_argument('classes', type=str, nargs='*', 
                         help='space-separated list of class names')
     parser.add_argument('--all', help='listens to changes to all classes',
diff --git a/python/samples/interface-handler b/python/samples/interface-handler
--- a/python/samples/interface-handler
+++ b/python/samples/interface-handler
@@ -119,7 +119,14 @@ if __name__ == "__main__":
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Creates a runtime object per network interface on the 
machine and populates the ipv4Addresses and ipv6Addresses attributes.')
+        description='''Creates a runtime object per network interface on the 
machine and populates the ipv4Addresses and ipv6Addresses attributes.
+
+Use like this:
+
+$ interface-handler &
+
+$ immfind -c InterfaceRO01
+''', formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/interface-handler-inheritance-impl 
b/python/samples/interface-handler-inheritance-impl
--- a/python/samples/interface-handler-inheritance-impl
+++ b/python/samples/interface-handler-inheritance-impl
@@ -122,7 +122,14 @@ if __name__ == "__main__":
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Creates a runtime object per network interface on the 
machine and populates the ipv4Addresses and ipv6Addresses attributes.')
+        description='''Creates a runtime object per network interface on the 
machine and populates the ipv4Addresses and ipv6Addresses attributes.
+
+Use like this:
+
+$ interface-handler-inheritance-impl &
+
+$ immfind -c InterfaceRO01
+''', formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/ping-pong b/python/samples/ping-pong
--- a/python/samples/ping-pong
+++ b/python/samples/ping-pong
@@ -51,8 +51,15 @@ if __name__ == '__main__':
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Logs and replies to admin operations 0 and 1 towards %s,'
-        ' and replies' % dn)
+        description='''Logs and replies to admin operations 0 and 1 towards %s,
+and replies
+
+Use like this:
+
+$ ping-pong &
+
+$ immadm -o [0|1] pingPongId=1 <parameters..>
+''' % dn, formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/ping-pong-inheritance-impl 
b/python/samples/ping-pong-inheritance-impl
--- a/python/samples/ping-pong-inheritance-impl
+++ b/python/samples/ping-pong-inheritance-impl
@@ -50,8 +50,15 @@ if __name__ == '__main__':
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Logs and replies to admin operations 0 and 1 towards %s,'
-        ' and replies' % dn)
+        description='''Logs and replies to admin operations 0 and 1 towards %s,
+and replies
+
+Use like this:
+
+$ ping-pong-inheritance-impl &
+
+$ immadm -o [0|1] pingPongId=1 <parameters..>
+''' % dn, formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/time-reporter b/python/samples/time-reporter
--- a/python/samples/time-reporter
+++ b/python/samples/time-reporter
@@ -46,9 +46,18 @@ def select_loop(implementer):
 
 if __name__ == '__main__':
 
+
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Keeps the %s object updated with the current time' % dn)
+        description='''Keeps the %s object updated with the current time.
+
+Use like this:
+
+$ time-reporter &
+
+$ immlist timeId=1
+
+''' % dn, formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/time-reporter-inheritance-impl 
b/python/samples/time-reporter-inheritance-impl
--- a/python/samples/time-reporter-inheritance-impl
+++ b/python/samples/time-reporter-inheritance-impl
@@ -78,7 +78,15 @@ if __name__ == '__main__':
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Keeps the %s object updated with the current time' % dn)
+        description='''Keeps the %s object updated with the current time.
+
+Use like this:
+
+$ time-reporter-inheritance-impl &
+
+$ immlist timeId=1
+
+''' % dn, formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/tones b/python/samples/tones
--- a/python/samples/tones
+++ b/python/samples/tones
@@ -11,8 +11,21 @@ if __name__ == "__main__":
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description=('Ensures that instances of %s can only be created in this 
'
-                     'order.') % ', '.join(tone_class_names))
+        description=('''Ensures that instances of %s can only be created in 
this '
+                     'order.
+
+Use like this:
+
+$ tones &
+
+$ immcfg -c Do doId=1                 (allowed)
+
+$ immcfg -c Re reId=1,doId=1          (allowed)
+
+$ immcfg -c Do doId=1,reId=1,doId=1   (not allowed)
+
+$ immcfg -c Mi miId=1                 (not allowed)
+''') % ', '.join(tone_class_names), 
formatter_class=argparse.RawTextHelpFormatter)
 
     args = parser.parse_args()
 
diff --git a/python/samples/tones-inheritance-impl 
b/python/samples/tones-inheritance-impl
--- a/python/samples/tones-inheritance-impl
+++ b/python/samples/tones-inheritance-impl
@@ -30,8 +30,21 @@ if __name__ == "__main__":
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description=('Ensures that instances of %s can only be created in this 
'
-                     'order.') % ', '.join(tone_class_names))
+        description=('''Ensures that instances of %s can only be created in 
this '
+                     'order.
+
+Use like this:
+
+$ tones-inheritance-impl &
+
+$ immcfg -c Do doId=1                 (allowed)
+
+$ immcfg -c Re reId=1,doId=1          (allowed)
+
+$ immcfg -c Do doId=1,reId=1,doId=1   (not allowed)
+
+$ immcfg -c Mi miId=1                 (not allowed)
+''') % ', '.join(tone_class_names), 
formatter_class=argparse.RawTextHelpFormatter)
 
     args = parser.parse_args()
 
diff --git a/python/samples/users b/python/samples/users
--- a/python/samples/users
+++ b/python/samples/users
@@ -17,9 +17,16 @@ if __name__ == '__main__':
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Creates the usersId=1 object and updates its users '
-        'attribute with the current list of logged in users when it\' read '
-        'in IMM.')
+        description='''Creates the usersId=1 object and updates its users
+attribute with the current list of logged in users when it is read
+in IMM.
+
+Use like this:
+
+$ users &
+
+$ immlist usersId=1
+''', formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 
diff --git a/python/samples/users-inheritance-impl 
b/python/samples/users-inheritance-impl
--- a/python/samples/users-inheritance-impl
+++ b/python/samples/users-inheritance-impl
@@ -22,9 +22,16 @@ if __name__ == '__main__':
 
     # Parse command line arguments
     parser = argparse.ArgumentParser(
-        description='Creates the usersId=1 object and updates its users '
-        'attribute with the current list of logged in users when it\' read '
-        'in IMM.')
+        description='''Creates the usersId=1 object and updates its users
+attribute with the current list of logged in users when it is read
+in IMM.
+
+Use like this:
+
+$ users-inheritance-impl &
+
+$ immlist usersId=1
+''', formatter_class=argparse.RawTextHelpFormatter)
 
     parser.parse_args()
 

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to