[Lldb-commits] [lldb] Add the ability to define a Python based command that uses CommandObjectParsed (PR #70734)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 2 12:44:12 PDT 2023
================
@@ -0,0 +1,315 @@
+"""
+This module implements a couple of utility classes to make writing
+lldb parsed commands more Pythonic.
+The way to use it is to make a class for you command that inherits from ParsedCommandBase.
----------------
jimingham wrote:
The problem with that approach is that completion happens in C++ in the CommandInterpreter, and if argparse were doing the parsing, to support completion the CommandInterpreter would have to call back to argparse to figure out which option was being completed.
What I tried to do is make the interface for defining your options look the same as what you would have written for argparse so that if you have an extant command it will be easy to convert it and if you know argparse, you know how to define lldb commands already, the only difference being you don't use argparse, you add it to our object instead.
Look at the test_commands.py in the tests to get a sense of what that looks like.
https://github.com/llvm/llvm-project/pull/70734
More information about the lldb-commits
mailing list