laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/33705 ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: pySim-shell: Add a mode where a pySim-shell cmd can be passed by shell ...................................................................... pySim-shell: Add a mode where a pySim-shell cmd can be passed by shell This adds a new operation mode for pySim-shell, where a single command can be passed to pySim-shell, which then is executed before pySim-shell terminates. Example: ./pySim-shell.py -p0 export --json Change-Id: I0ed379b23a4b1126006fd8f9e7ba2ba07fb01ada Closes: OS#6088 --- M pySim-shell.py 1 file changed, 25 insertions(+), 1 deletion(-) Approvals: dexter: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/pySim-shell.py b/pySim-shell.py index 213f057..3b56bfd 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -982,6 +982,11 @@ 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("command", nargs='?', + help="A pySim-shell command that would optionally be executed at startup") +option_parser.add_argument('command_args', nargs=argparse.REMAINDER, + help="Optional Arguments for command") + if __name__ == '__main__': @@ -1045,4 +1050,7 @@ except Exception as e: print(e) - app.cmdloop() + if opts.command: + app.onecmd_plus_hooks('{} {}'.format(opts.command, ' '.join(opts.command_args))) + else: + app.cmdloop() -- To view, visit https://gerrit.osmocom.org/c/pysim/+/33705 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I0ed379b23a4b1126006fd8f9e7ba2ba07fb01ada Gerrit-Change-Number: 33705 Gerrit-PatchSet: 3 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier@sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-MessageType: merged