ttrack
ttrack copied to clipboard
Additional interface for automation, based on JSON
Based on the syntax and variable names contained in it, this patch adds a JSON interface using those names as dictionary lookup keys.
The interface is an added onecmd_json()
that expects JSON input, either in string from or as parsed by the json.loads()
function, but other than the command format and its better suitability for automation, it works exactly like onecmd()
for manually entered strings.
The key do_
holds the token words to use, including the command to run; the key stdin_
may be added with the value to feed into standard input; upon return, stdout_
is set to what is printed on standard output and, if anything is printed on standard error, it can be found in stderr_
.
This work was done for the InternetWide project where it allows the same shell to be used by operators and remote services.
Andrew,
I made this donation because of your invitation "feel free to send me pull requests if you make an improvement you feel others would find useful" but can you please decide on accept-or-reject? I would like to flatten the temporary patches in our builds, preferably to your "pip install" package.
Thanks! -Rick