Change in pysim[master]: pySim-shell: Introduce logical grouping of arguments

laforge gerrit-no-reply at lists.osmocom.org
Sun Apr 11 10:35:34 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/23719 )


Change subject: pySim-shell: Introduce logical grouping of arguments
......................................................................

pySim-shell: Introduce logical grouping of arguments

Change-Id: Id80a68e615fc1e457bde3dff8817776826fc6d8e
---
M pySim-shell.py
1 file changed, 29 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/19/23719/1

diff --git a/pySim-shell.py b/pySim-shell.py
index 6bc9a95..2a7c377 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -431,26 +431,38 @@
 
 option_parser = argparse.ArgumentParser(prog='pySim-shell', description='interactive SIM card shell',
                                         formatter_class=argparse.ArgumentDefaultsHelpFormatter)
-option_parser.add_argument('-d', '--device', metavar='DEV', default='/dev/ttyUSB0',
-                           help='Serial Device for SIM access')
-option_parser.add_argument('-b', '--baud', dest='baudrate', type=int, metavar='BAUD', default=9600,
-                           help='Baud rate used for SIM access')
-option_parser.add_argument('-p', '--pcsc-device', type=int, dest='pcsc_dev', metavar='PCSC', default=None,
-                           help='PC/SC reader number to use for SIM access')
-option_parser.add_argument('--modem-device', dest='modem_dev', metavar='DEV', default=None,
-                           help='Serial port of modem for Generic SIM Access (3GPP TS 27.007)')
-option_parser.add_argument('--modem-baud', type=int, metavar='BAUD', default=115200,
-                           help='Baud rate used for modem port')
-option_parser.add_argument('--osmocon', dest='osmocon_sock', metavar='PATH', default=None,
+
+serial_group = option_parser.add_argument_group('Serial Reader')
+serial_group.add_argument('-d', '--device', metavar='DEV', default='/dev/ttyUSB0',
+                          help='Serial Device for SIM access')
+serial_group.add_argument('-b', '--baud', dest='baudrate', type=int, metavar='BAUD', default=9600,
+                          help='Baud rate used for SIM access')
+
+pcsc_group = option_parser.add_argument_group('PC/SC Reader')
+pcsc_group.add_argument('-p', '--pcsc-device', type=int, dest='pcsc_dev', metavar='PCSC', default=None,
+                        help='PC/SC reader number to use for SIM access')
+
+modem_group = option_parser.add_argument_group('AT Command Modem Reader')
+modem_group.add_argument('--modem-device', dest='modem_dev', metavar='DEV', default=None,
+                         help='Serial port of modem for Generic SIM Access (3GPP TS 27.007)')
+modem_group.add_argument('--modem-baud', type=int, metavar='BAUD', default=115200,
+                         help='Baud rate used for modem port')
+
+osmobb_group = option_parser.add_argument_group('OsmocomBB Reader')
+osmobb_group.add_argument('--osmocon', dest='osmocon_sock', metavar='PATH', default=None,
                            help='Socket path for Calypso (e.g. Motorola C1XX) based reader (via OsmocomBB)')
-option_parser.add_argument('--script', metavar='PATH', default=None,
+
+global_group = option_parser.add_argument_group('General Options')
+global_group.add_argument('--script', metavar='PATH', default=None,
                            help='script with pySim-shell commands to be executed automatically at start-up')
-option_parser.add_argument('--csv', metavar='FILE', default=None,
+global_group.add_argument('--csv', metavar='FILE', default=None,
                            help='Read card data from CSV file')
-option_parser.add_argument('-a', '--pin-adm', metavar='PIN_ADM1', dest='pin_adm', default=None,
-                           help='ADM PIN used for provisioning (overwrites default)')
-option_parser.add_argument('-A', '--pin-adm-hex', metavar='PIN_ADM1_HEX', dest='pin_adm_hex', default=None,
-                           help='ADM PIN used for provisioning, as hex string (16 characters long)')
+
+adm_group = global_group.add_mutually_exclusive_group()
+adm_group.add_argument('-a', '--pin-adm', metavar='PIN_ADM1', dest='pin_adm', default=None,
+                       help='ADM PIN used for provisioning (overwrites default)')
+adm_group.add_argument('-A', '--pin-adm-hex', metavar='PIN_ADM1_HEX', dest='pin_adm_hex', default=None,
+                       help='ADM PIN used for provisioning, as hex string (16 characters long)')
 
 
 if __name__ == '__main__':

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/23719
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Id80a68e615fc1e457bde3dff8817776826fc6d8e
Gerrit-Change-Number: 23719
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210411/4404ee5a/attachment.htm>


More information about the gerrit-log mailing list