On Wed, Sep 03, 2025 at 01:11:12AM -0400, John Snow wrote: > Signed-off-by: John Snow <js...@redhat.com> > cherry picked from commit 20a88c2471f37d10520b2409046d59e1d0f1e905 > Signed-off-by: John Snow <js...@redhat.com>
Duplicate s-o-b > --- > python/qemu/qmp/qmp_shell.py | 35 ++++++++++++++++------------------- > 1 file changed, 16 insertions(+), 19 deletions(-) Wierdly the diffstat when I looked qmp_shell.py is very different from what your patch here shows, but the end result appears the same. Perhaps one of us has different settings for $HOME/.gitconfig that affects diff display Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> > > diff --git a/python/qemu/qmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py > index 98e684e9e8a..02028e94b5a 100644 > --- a/python/qemu/qmp/qmp_shell.py > +++ b/python/qemu/qmp/qmp_shell.py > @@ -514,21 +514,27 @@ def die(msg: str) -> NoReturn: > sys.exit(1) > > > +def common_parser() -> argparse.ArgumentParser: > + """Build common parsing options used by qmp-shell and qmp-shell-wrap.""" > + parser = argparse.ArgumentParser() > + parser.add_argument('-H', '--hmp', action='store_true', > + help='Use HMP interface') > + parser.add_argument('-v', '--verbose', action='store_true', > + help='Verbose (echo commands sent and received)') > + parser.add_argument('-p', '--pretty', action='store_true', > + help='Pretty-print JSON') > + parser.add_argument('-l', '--logfile', > + help='Save log of all QMP messages to PATH') > + return parser > + > + > def main() -> None: > """ > qmp-shell entry point: parse command line arguments and start the REPL. > """ > - parser = argparse.ArgumentParser() > - parser.add_argument('-H', '--hmp', action='store_true', > - help='Use HMP interface') > + parser = common_parser() > parser.add_argument('-N', '--skip-negotiation', action='store_true', > help='Skip negotiate (for qemu-ga)') > - parser.add_argument('-v', '--verbose', action='store_true', > - help='Verbose (echo commands sent and received)') > - parser.add_argument('-p', '--pretty', action='store_true', > - help='Pretty-print JSON') > - parser.add_argument('-l', '--logfile', > - help='Save log of all QMP messages to PATH') > > default_server = os.environ.get('QMP_SOCKET') > parser.add_argument('qmp_server', action='store', > @@ -564,16 +570,7 @@ def main_wrap() -> None: > qmp-shell-wrap entry point: parse command line arguments and > start the REPL. > """ > - parser = argparse.ArgumentParser() > - parser.add_argument('-H', '--hmp', action='store_true', > - help='Use HMP interface') > - parser.add_argument('-v', '--verbose', action='store_true', > - help='Verbose (echo commands sent and received)') > - parser.add_argument('-p', '--pretty', action='store_true', > - help='Pretty-print JSON') > - parser.add_argument('-l', '--logfile', > - help='Save log of all QMP messages to PATH') > - > + parser = common_parser() > parser.add_argument('command', nargs=argparse.REMAINDER, > help='QEMU command line to invoke') > > -- > 2.50.1 > With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|