Open tschwaller opened 9 years ago
Hi @tschwaller,
Thanks for the suggestion. I will try to create such an example.
There are several approaches. One way is to run a new CLI with another prompt and completer.
Another way it to reuse the same, but make both dynamic. The prompt itself can be made dynamic through the get_prompt_tokens
function (See this example: https://github.com/jonathanslenders/python-prompt-toolkit/blob/master/examples/colored-prompt.py). The completer can be made dynamic by having one completer, that depending on the state calls a second or third completer to do the actual completions.
Jonathan
Hi Jonathan (@jonathanslenders)
Thanks for the suggestion. I will try to create such an example.
thanks for looking into that! Appreciate it! The Python configshell might give you some inspiration how others solved that "problem".
https://github.com/agrover/configshell-fb http://www.risingtidesystems.com/git/?p=configshell.git;a=summary (Original version)
A simple example from me: ;-) https://tomsreadme.wordpress.com/2013/01/08/example-shell/
I looked at the colored-prompt.py example before and is was actually the reason why I opened this ticket to go one step further. The next step would be to use YAML to describe a shell similar to klish doing it with XML, but that is probably asking too much. ;-)
http://libcode.org/projects/klish/
Looking forward to the subcommand example!
Tom
Hi @tschwaller,
This is a very long time ago, but now I have an open pull request for this: https://github.com/prompt-toolkit/python-prompt-toolkit/pull/929
Would that solve your issue?
[edit] I don't think it's exactly this, but related.
Add an example how to implement a subcommand, e.g.
The prompt changes and also the available commands in the subcontext.