Skip to content

[lldb] Rename scripting template to scripting extension (NFC) #101935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

medismailben
Copy link
Member

This patch renames the scripting template subcommand to be scripting extension instead since that would make more sense for upcoming commands.

This patch renames the `scripting template` subcommand to be `scripting
extension` instead since that would make more sense for upcoming
commands.

Signed-off-by: Med Ismail Bennani <[email protected]>
@llvmbot
Copy link
Member

llvmbot commented Aug 5, 2024

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

Changes

This patch renames the scripting template subcommand to be scripting extension instead since that would make more sense for upcoming commands.


Full diff: https://github.com/llvm/llvm-project/pull/101935.diff

3 Files Affected:

  • (modified) lldb/source/Commands/CommandObjectScripting.cpp (+19-19)
  • (modified) lldb/source/Commands/Options.td (+2-2)
  • (renamed) lldb/test/Shell/Commands/command-scripting-extension-list.test (+2-2)
diff --git a/lldb/source/Commands/CommandObjectScripting.cpp b/lldb/source/Commands/CommandObjectScripting.cpp
index 730a190a6e891..698e297520020 100644
--- a/lldb/source/Commands/CommandObjectScripting.cpp
+++ b/lldb/source/Commands/CommandObjectScripting.cpp
@@ -129,18 +129,18 @@ class CommandObjectScriptingRun : public CommandObjectRaw {
   CommandOptions m_options;
 };
 
-#define LLDB_OPTIONS_scripting_template_list
+#define LLDB_OPTIONS_scripting_extension_list
 #include "CommandOptions.inc"
 
-class CommandObjectScriptingTemplateList : public CommandObjectParsed {
+class CommandObjectScriptingExtensionList : public CommandObjectParsed {
 public:
-  CommandObjectScriptingTemplateList(CommandInterpreter &interpreter)
+  CommandObjectScriptingExtensionList(CommandInterpreter &interpreter)
       : CommandObjectParsed(
-            interpreter, "scripting template list",
+            interpreter, "scripting extension list",
             "List all the available scripting extension templates. ",
             "scripting template list [--language <scripting-language> --]") {}
 
-  ~CommandObjectScriptingTemplateList() override = default;
+  ~CommandObjectScriptingExtensionList() override = default;
 
   Options *GetOptions() override { return &m_options; }
 
@@ -174,7 +174,7 @@ class CommandObjectScriptingTemplateList : public CommandObjectParsed {
     }
 
     llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
-      return llvm::ArrayRef(g_scripting_template_list_options);
+      return llvm::ArrayRef(g_scripting_extension_list_options);
     }
 
     lldb::ScriptLanguage m_language = lldb::eScriptLanguageDefault;
@@ -195,8 +195,8 @@ class CommandObjectScriptingTemplateList : public CommandObjectParsed {
     };
 
     size_t num_listed_interface = 0;
-    size_t num_templates = PluginManager::GetNumScriptedInterfaces();
-    for (size_t i = 0; i < num_templates; i++) {
+    size_t num_extensions = PluginManager::GetNumScriptedInterfaces();
+    for (size_t i = 0; i < num_extensions; i++) {
       llvm::StringRef plugin_name =
           PluginManager::GetScriptedInterfaceNameAtIndex(i);
       if (plugin_name.empty())
@@ -223,7 +223,7 @@ class CommandObjectScriptingTemplateList : public CommandObjectParsed {
       usages.Dump(s, ScriptedInterfaceUsages::UsageKind::API);
       usages.Dump(s, ScriptedInterfaceUsages::UsageKind::CommandInterpreter);
 
-      if (i != num_templates - 1)
+      if (i != num_extensions - 1)
         s.EOL();
     }
 
@@ -235,19 +235,19 @@ class CommandObjectScriptingTemplateList : public CommandObjectParsed {
   CommandOptions m_options;
 };
 
-class CommandObjectMultiwordScriptingTemplate : public CommandObjectMultiword {
+class CommandObjectMultiwordScriptingExtension : public CommandObjectMultiword {
 public:
-  CommandObjectMultiwordScriptingTemplate(CommandInterpreter &interpreter)
+  CommandObjectMultiwordScriptingExtension(CommandInterpreter &interpreter)
       : CommandObjectMultiword(
-            interpreter, "scripting template",
-            "Commands for operating on the scripting templates.",
-            "scripting template [<subcommand-options>]") {
+            interpreter, "scripting extension",
+            "Commands for operating on the scripting extensions.",
+            "scripting extension [<subcommand-options>]") {
     LoadSubCommand(
         "list",
-        CommandObjectSP(new CommandObjectScriptingTemplateList(interpreter)));
+        CommandObjectSP(new CommandObjectScriptingExtensionList(interpreter)));
   }
 
-  ~CommandObjectMultiwordScriptingTemplate() override = default;
+  ~CommandObjectMultiwordScriptingExtension() override = default;
 };
 
 CommandObjectMultiwordScripting::CommandObjectMultiwordScripting(
@@ -258,9 +258,9 @@ CommandObjectMultiwordScripting::CommandObjectMultiwordScripting(
           "scripting <subcommand> [<subcommand-options>]") {
   LoadSubCommand("run",
                  CommandObjectSP(new CommandObjectScriptingRun(interpreter)));
-  LoadSubCommand("template",
-                 CommandObjectSP(
-                     new CommandObjectMultiwordScriptingTemplate(interpreter)));
+  LoadSubCommand("extension",
+                 CommandObjectSP(new CommandObjectMultiwordScriptingExtension(
+                     interpreter)));
 }
 
 CommandObjectMultiwordScripting::~CommandObjectMultiwordScripting() = default;
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index 6e5ed21b22ad8..f050cd2ebb5ae 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -841,8 +841,8 @@ let Command = "scripting run" in {
     " language. If none is specific the default scripting language is used.">;
 }
 
-let Command = "scripting template list" in {
-  def scripting_template_list_language : Option<"language", "l">,
+let Command = "scripting extension list" in {
+  def scripting_extension_list_language : Option<"language", "l">,
     EnumArg<"ScriptLang">, Desc<"Specify the scripting "
     " language. If none is specified the default scripting language is used.">;
 }
diff --git a/lldb/test/Shell/Commands/command-scripting-template-list.test b/lldb/test/Shell/Commands/command-scripting-extension-list.test
similarity index 96%
rename from lldb/test/Shell/Commands/command-scripting-template-list.test
rename to lldb/test/Shell/Commands/command-scripting-extension-list.test
index 8dc3fe42931ab..c8c0343820b8f 100644
--- a/lldb/test/Shell/Commands/command-scripting-template-list.test
+++ b/lldb/test/Shell/Commands/command-scripting-extension-list.test
@@ -1,7 +1,7 @@
 # REQUIRES: python
 # RUN: %lldb -s %s -o exit | FileCheck %s
 
-scripting template list
+scripting extension list
 # CHECK:Available scripted extension templates:
 
 # CHECK:  Name: OperatingSystemPythonInterface
@@ -38,5 +38,5 @@ scripting template list
 # CHECK-NEXT:  API Usages: SBThread.StepUsingScriptedThreadPlan
 # CHECK-NEXT:  Command Interpreter Usages: thread step-scripted -C <script-name> [-k key -v value ...]
 
-scripting template list -l lua
+scripting extension list -l lua
 # CHECK: Available scripted extension templates: None

Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the things listed are "scripting extensions" and then there are templates to get started using those extensions. Makes sense to me.

Copy link
Collaborator

@jimingham jimingham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@medismailben medismailben merged commit 5689ccc into llvm:main Aug 5, 2024
8 checks passed
adrian-prantl pushed a commit to swiftlang/llvm-project that referenced this pull request Oct 11, 2024
…vm#101935)

This patch renames the `scripting template` subcommand to be `scripting
extension` instead since that would make more sense for upcoming
commands.

Signed-off-by: Med Ismail Bennani <[email protected]>
(cherry picked from commit 5689ccc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants