mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-30 01:19:37 +03:00
pySim-shell: New '-e' command line argument
Using '-e' it is possible to specify *multiple* pySim-shell commands which shall be executed at startup. This extends the current ability to execute just a single command. Example: ./pySim-shell.py -p0 -e 'select ADF.USIM/EF.IMSI' -e 'read_binary_decoded' Change-Id: I74004f46105553f077c039ca0f86f75afccc7342
This commit is contained in:
@@ -1056,6 +1056,8 @@ adm_group.add_argument('-a', '--pin-adm', metavar='PIN_ADM1', dest='pin_adm', de
|
|||||||
adm_group.add_argument('-A', '--pin-adm-hex', metavar='PIN_ADM1_HEX', dest='pin_adm_hex', default=None,
|
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)')
|
help='ADM PIN used for provisioning, as hex string (16 characters long)')
|
||||||
|
|
||||||
|
option_parser.add_argument('-e', '--execute-command', action='append', default=[],
|
||||||
|
help='A pySim-shell command that will be executed at startup')
|
||||||
option_parser.add_argument("command", nargs='?',
|
option_parser.add_argument("command", nargs='?',
|
||||||
help="A pySim-shell command that would optionally be executed at startup")
|
help="A pySim-shell command that would optionally be executed at startup")
|
||||||
option_parser.add_argument('command_args', nargs=argparse.REMAINDER,
|
option_parser.add_argument('command_args', nargs=argparse.REMAINDER,
|
||||||
@@ -1122,6 +1124,13 @@ if __name__ == '__main__':
|
|||||||
print(e)
|
print(e)
|
||||||
print("---------------------8<---------------------")
|
print("---------------------8<---------------------")
|
||||||
|
|
||||||
|
# Run optional commands
|
||||||
|
for c in opts.execute_command:
|
||||||
|
if not startup_errors:
|
||||||
|
app.onecmd_plus_hooks(c)
|
||||||
|
else:
|
||||||
|
print("Errors during startup, refusing to execute command (%s)" % c)
|
||||||
|
|
||||||
# Run optional command
|
# Run optional command
|
||||||
if opts.command:
|
if opts.command:
|
||||||
if not startup_errors:
|
if not startup_errors:
|
||||||
|
|||||||
Reference in New Issue
Block a user