From a5f1ef5d7ac6d4fb1cb8f39b0bec8727a5c2e0d4 Mon Sep 17 00:00:00 2001 From: clach04 Date: Sat, 9 Nov 2024 09:22:40 -0800 Subject: [PATCH] ptig new exec flag to issue a comment as if enter interactively --- puren_tonbo/tools/ptig.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/puren_tonbo/tools/ptig.py b/puren_tonbo/tools/ptig.py index f6f5af0..b8c8fda 100755 --- a/puren_tonbo/tools/ptig.py +++ b/puren_tonbo/tools/ptig.py @@ -1133,6 +1133,7 @@ def main(argv=None): parser.add_option("-c", "--codec", help="Override config file encoding (can be a list TODO format comma?)") parser.add_option("--config-file", "--config_file", help="Override config file") parser.add_option("--note-root", help="Directory of notes, or dir_name_or_filename1.... will pick up from config file and default to '.'") + parser.add_option("-e", "--exec", help="Command to issue after initialization (init config section - TODO decide one-off-and-exit, or enter command loop?)") parser.add_option("-p", "--password", help="password, if omitted and OS env PT_PASSWORD is set use that, next checks keyring, if missing prompt") parser.add_option("-P", "--password_file", help="file name where password is to be read from, trailing blanks are ignored") @@ -1208,6 +1209,8 @@ def main(argv=None): setattr(interpreter, 'do_' + editor, FakeMethodEdit(editor, interpreter)) for command in ptig_options.get('init', []): interpreter.onecmd(command) + if options.exec: + interpreter.onecmd(options.exec) interpreter.cmdloop() return 0