]> code.ossystems Code Review - openembedded-core.git/commitdiff
oepydevshell-internal.py: standardize usage output
authorEd Bartosh <ed.bartosh@linux.intel.com>
Fri, 9 Dec 2016 15:02:30 +0000 (17:02 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 13 Dec 2016 22:47:31 +0000 (22:47 +0000)
Made usage output of oepydevshell-internal.py to look
similar to the output of other oe scripts.

[YOCTO #10751]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/oepydevshell-internal.py

index a22bec3365f6036936f17ecf0fa228156c9868c9..04621ae8a137ae6f9edcd3bdbf920b2e82df0ef0 100755 (executable)
@@ -22,9 +22,16 @@ def cbreaknoecho(fd):
     old[3] = old[3] &~ termios.ECHO &~ termios.ICANON
     termios.tcsetattr(fd, termios.TCSADRAIN, old)
 
-if len(sys.argv) != 3:
-    print("Incorrect parameters")
-    sys.exit(1)
+if len(sys.argv) != 3 or sys.argv[1] in ('-h', '--help'):
+    print('oepydevshell-internal.py: error: the following arguments are required: pty, pid\n'
+          'Usage: oepydevshell-internal.py pty pid\n\n'
+          'OpenEmbedded oepydevshell-internal.py - internal script called from meta/classes/devshell.bbclass\n\n'
+          'arguments:\n'
+          '  pty                   pty device name\n'
+          '  pid                   parent process id\n\n'
+          'options:\n'
+          '  -h, --help            show this help message and exit\n')
+    sys.exit(2)
 
 pty = open(sys.argv[1], "w+b", 0)
 parent = int(sys.argv[2])
@@ -38,7 +45,7 @@ readline.parse_and_bind("tab: complete")
 try:
     readline.read_history_file(histfile)
 except IOError:
-    pass 
+    pass
 
 try: