pySim-shell, cosmetic: define positional arguments last

When we define command arguments using the ArgumentParser, we sometimes
define the positional arguments first. However, since positional arguments
usually follow after the optional (--xyz) arguments, we should define the
positional arguments last.

Related: OS#6531
Change-Id: I2412eb6e7dc32ae95a575f31d4489ce210d85ea0
This commit is contained in:
Philipp Maier
2024-08-22 11:05:06 +02:00
parent edf266726d
commit d5943934a5
4 changed files with 14 additions and 14 deletions

View File

@@ -236,9 +236,9 @@ Online manual available at https://downloads.osmocom.org/docs/pysim/master/html/
self.equip(card, rs)
apdu_cmd_parser = argparse.ArgumentParser()
apdu_cmd_parser.add_argument('APDU', type=is_hexstr, help='APDU as hex string')
apdu_cmd_parser.add_argument('--expect-sw', help='expect a specified status word', type=str, default=None)
apdu_cmd_parser.add_argument('--raw', help='Bypass the logical channel (and secure channel)', action='store_true')
apdu_cmd_parser.add_argument('APDU', type=is_hexstr, help='APDU as hex string')
@cmd2.with_argparser(apdu_cmd_parser)
def do_apdu(self, opts):
@@ -770,13 +770,13 @@ class PySimCommands(CommandSet):
self._cmd.poutput("no description available")
verify_adm_parser = argparse.ArgumentParser()
verify_adm_parser.add_argument('ADM', nargs='?', type=is_hexstr_or_decimal,
help='ADM pin value. If none given, CSV file will be queried')
verify_adm_parser.add_argument('--pin-is-hex', action='store_true',
help='ADM pin value is specified as hex-string (not decimal)')
verify_adm_parser.add_argument('--adm-type',
choices=[x for x in pin_names.values() if x.startswith('ADM')],
help='Override ADM number. Default is card-model-specific, usually 1')
verify_adm_parser.add_argument('ADM', nargs='?', type=is_hexstr_or_decimal,
help='ADM pin value. If none given, CSV file will be queried')
@cmd2.with_argparser(verify_adm_parser)
def do_verify_adm(self, opts):