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

@@ -636,9 +636,9 @@ class TransparentEF(CardEF):
self._cmd.poutput(data)
upd_bin_dec_parser = argparse.ArgumentParser()
upd_bin_dec_parser.add_argument('data', help='Abstract data (JSON format) to write')
upd_bin_dec_parser.add_argument('--json-path', type=str,
help='JSON path to modify specific element of file only')
upd_bin_dec_parser.add_argument('data', help='Abstract data (JSON format) to write')
@cmd2.with_argparser(upd_bin_dec_parser)
def do_update_binary_decoded(self, opts):
@@ -838,10 +838,10 @@ class LinFixedEF(CardEF):
self._cmd.poutput_json(data, opts.oneline)
read_rec_parser = argparse.ArgumentParser()
read_rec_parser.add_argument(
'record_nr', type=auto_uint8, help='Number of record to be read')
read_rec_parser.add_argument(
'--count', type=auto_uint8, default=1, help='Number of records to be read, beginning at record_nr')
read_rec_parser.add_argument(
'record_nr', type=auto_uint8, help='Number of record to be read')
@cmd2.with_argparser(read_rec_parser)
def do_read_record(self, opts):
@@ -856,10 +856,10 @@ class LinFixedEF(CardEF):
self._cmd.poutput("%03d %s" % (recnr, recstr))
read_rec_dec_parser = argparse.ArgumentParser()
read_rec_dec_parser.add_argument(
'record_nr', type=auto_uint8, help='Number of record to be read')
read_rec_dec_parser.add_argument('--oneline', action='store_true',
help='No JSON pretty-printing, dump as a single line')
read_rec_dec_parser.add_argument(
'record_nr', type=auto_uint8, help='Number of record to be read')
@cmd2.with_argparser(read_rec_dec_parser)
def do_read_record_decoded(self, opts):
@@ -909,11 +909,11 @@ class LinFixedEF(CardEF):
self._cmd.poutput(data)
upd_rec_dec_parser = argparse.ArgumentParser()
upd_rec_dec_parser.add_argument('--json-path', type=str,
help='JSON path to modify specific element of record only')
upd_rec_dec_parser.add_argument(
'record_nr', type=auto_uint8, help='Number of record to be read')
upd_rec_dec_parser.add_argument('data', help='Abstract data (JSON format) to write')
upd_rec_dec_parser.add_argument('--json-path', type=str,
help='JSON path to modify specific element of record only')
@cmd2.with_argparser(upd_rec_dec_parser)
def do_update_record_decoded(self, opts):