================
@@ -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">;
----------------
PiJoules wrote:
What happens if a user would define a `Subcommand` with the name
`"TopLevelCommand"`? I'm assuming there should only be one with this name
assuming it's like a sentinel. If only one should be defined, are there any
checks that would assert this or diagnose if more than one was provided?
https://github.com/llvm/llvm-project/pull/155026
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits