Closed khromenokroman closed 2 months ago
What are the advantage over adding a shebang for Python3 in the script and then use something like this in the CLI specification?
shell("System command"), cli_start_shell("bash");{
<source:rest>("Single shell command"), cli_start_shell("bash");
}
Any Python script can then be called as long as #!/bin/env python3
or similar are added to the top of the file and the file is executable and "shell" can of course be renamed.
debian@khn-dev /> shell /tmp/test.py
foo
It would be nice to add a documentation section somewhere here: https://clixon-docs.readthedocs.io/en/latest/cli.html on how to use scripts (specifically python) as callbacks.
What are the advantage over adding a shebang for Python3 in the script and then use something like this in the CLI specification?
shell("System command"), cli_start_shell("bash");{ <source:rest>("Single shell command"), cli_start_shell("bash"); }
Any Python script can then be called as long as
#!/bin/env python3
or similar are added to the top of the file and the file is executable and "shell" can of course be renamed.debian@khn-dev /> shell /tmp/test.py foo
That's right, you can do this. But then it will be like this
And with my version it will be like this
I think it's better this way. But I could be wrong :)
It would be nice to add a documentation section somewhere here: https://clixon-docs.readthedocs.io/en/latest/cli.html on how to use scripts (specifically python) as callbacks.
I'll try to do it now
It would be nice to add a documentation section somewhere here: https://clixon-docs.readthedocs.io/en/latest/cli.html on how to use scripts (specifically python) as callbacks.
I'll try to do it now
You need to checkout the old version of configure for tests to parse
I think it's better this way. But I could be wrong :) Yes, but can you do it more generalized, so that it is not hardcoded to /usr/bin/python3? I can see it being useful for other scripts (or even if python is installed elsewhere.u This is the advantage of the existing cli_start_shell.
I see you close this PR. I think it is important to improve the scripting interface, and also its documentation, and I think your comments made sense. Are you planning to make a new PR?
I see you close this PR. I think it is important to improve the scripting interface, and also its documentation, and I think your comments made sense. Are you planning to make a new PR?
yes, I will correct the comments, they were correct, and make a new pool request
This commit includes a new function
cli_start_python3
which executes Python3 scripts from within the CLI. The function operates as a new command in the CLI interface, accepting a path to the script as an argument. This enhancement improves the versatility of the Clixon CLI interface by allowing direct execution of Python scripts.