================
@@ -98,7 +98,23 @@ class HelpTextVariant<list<OptionVisibility> visibilities, 
string text> {
   string Text = text;
 }
 
-class Option<list<string> prefixes, string name, OptionKind kind> {
+// Base class for TopLevelCommand and Subcommands.
+class Command<string name> { string Name = name; }
+
+// Class definition for positional subcommands.
+class Subcommand<string name, string helpText, string usage = "">
+    : Command<name> {
+  string HelpText = helpText;
+  string Usage = usage;
+}
+
+// Compile time representation for top level command (aka toolname).
+// Offers backward compatibility with existing Option class definitions before
+// introduction of commandGroup in Option class to support subcommands.
+def TopLevelCommand : Command<"TopLevelCommand">;
----------------
Prabhuk wrote:

That's a good point. I'll add the check. Maybe it's worth changing the name to 
something that is probably not going to be useful as a user defined subcommand 
name. "TopLevelCommand" -> "__TOPLEVELCOMMAND__". Other option could be a 
"Command" type object with empty string for name to depict the top level 
command. I can make sure all the subcommands have a non empty string name. 

https://github.com/llvm/llvm-project/pull/155026
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to