laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38255?usp=email )
Change subject: pySim-shell: New '-e' command line argument ......................................................................
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 --- M pySim-shell.py 1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/55/38255/1
diff --git a/pySim-shell.py b/pySim-shell.py index 8c260aa..756ba68 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -1056,6 +1056,8 @@ 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)')
+option_parser.add_argument('-e', '--execute-command', action='append', + help='A pySim-shell command that will be executed at startup') option_parser.add_argument("command", nargs='?', help="A pySim-shell command that would optionally be executed at startup") option_parser.add_argument('command_args', nargs=argparse.REMAINDER, @@ -1122,6 +1124,13 @@ print(e) 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 if opts.command: if not startup_errors: