[Lldb-commits] [lldb] e382057 - [lldb] tab completion for `platform target-install`

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 10 11:15:20 PDT 2020


Author: Gongyu Deng
Date: 2020-08-10T20:14:46+02:00
New Revision: e3820570d406f56a25eee681df03a394882febb0

URL: https://github.com/llvm/llvm-project/commit/e3820570d406f56a25eee681df03a394882febb0
DIFF: https://github.com/llvm/llvm-project/commit/e3820570d406f56a25eee681df03a394882febb0.diff

LOG: [lldb] tab completion for `platform target-install`

1. Applied the common completion `eDiskFileCompletion` to the first argument of
the command `platform target-install`.
2. Added a related test case.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D84179

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectPlatform.cpp
    lldb/test/API/functionalities/completion/TestCompletion.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index fcc8af6f915c..4c235cb866a6 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -1706,6 +1706,16 @@ class CommandObjectPlatformInstall : public CommandObjectParsed {
 
   ~CommandObjectPlatformInstall() override = default;
 
+  void
+  HandleArgumentCompletion(CompletionRequest &request,
+                           OptionElementVector &opt_element_vector) override {
+    if (request.GetCursorIndex())
+      return;
+    CommandCompletions::InvokeCommonCompletionCallbacks(
+        GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
+        request, nullptr);
+  }
+
   bool DoExecute(Args &args, CommandReturnObject &result) override {
     if (args.GetArgumentCount() != 2) {
       result.AppendError("platform target-install takes two arguments");

diff  --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index 0cec206025d1..da66f896e135 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -426,6 +426,9 @@ def test_frame_recognizer_delete(self):
         self.runCmd("frame recognizer add -l py_class -s module_name -n recognizer_name")
         self.check_completion_with_desc('frame recognizer delete ', [['0', 'py_class, module module_name, symbol recognizer_name']])
 
+    def test_platform_install_local_file(self):
+        self.complete_from_to('platform target-install main.cp', 'platform target-install main.cpp')
+
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489")
     def test_symbol_name(self):
         self.build()


        


More information about the lldb-commits mailing list