Am 27.01.2020 um 21:29 hat Dr. David Alan Gilbert geschrieben: > * Kevin Wolf (kw...@redhat.com) wrote: > > A command history already exists for qmp-shell. It's better than bash > > because it doesn't mix QMP history with whatever else I do on my > > computer. > > > > Autocomplete in qmp-shell doesn't exist, as far as I know, but if > > implemented, it could be a lot more useful than bash completion because > > it could offer key completion based on the QMP schema. > > > > This is in fact a big part of the problem that qmp-shell really needs to > > solve before it can replace HMP: How to make writing commands at least > > almost as simple as with HMP. If I can just press tab a few times to > > cycle through the available options for the command, that would already > > be a massive improvement over writing JSON manually (which you would > > still have to do with your text-file based approach, without any > > QMP-specific support). > > Doing all that in a python process (i.e. an actual python shell with a > bunch of qemu commands added) seems easyish.
It does. Polishing everything for the perfect experience could be a bit more work, but just querying the schema and providing some autocompletion from it sounds easy enough. > > The other part that it needs to solve is how to be available by default > > without specifying anything on the command line. Basically, if I press > > Ctrl-Alt-2, I want to get to a monitor shell. If that shell is > > implemented internally or by an external Python process, I don't mind. > > That is a harder part. (I rarely use Ctrl-Alt-2 actually; I mostly > use HMP on stdin). I don't think it would be that hard, actually. If you have a -qmp-shell option that takes a chardev and defaults to vc, you've solved the part with both stdio and Ctrl-Alt-2. Now all you need to do is launch the Python child process, pass it a pair of pipes for communication and forward everything between the pipes and the chardev. (That's the theory anyway.) Kevin