mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:44:46 +01:00
Refactor subcommand addition for sharing. (#4474)
Trying to standardize the setup a little more.
This commit is contained in:
@@ -9,7 +9,18 @@
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
constexpr CommandLine::CommandInfo ClangOptions::Info = {
|
||||
auto ClangOptions::Build(CommandLine::CommandBuilder& b) -> void {
|
||||
b.AddStringPositionalArg(
|
||||
{
|
||||
.name = "ARG",
|
||||
.help = R"""(
|
||||
Arguments passed to Clang.
|
||||
)""",
|
||||
},
|
||||
[&](auto& arg_b) { arg_b.Append(&args); });
|
||||
}
|
||||
|
||||
static constexpr CommandLine::CommandInfo SubcommandInfo = {
|
||||
.name = "clang",
|
||||
.help = R"""(
|
||||
Runs Clang on arguments.
|
||||
@@ -27,16 +38,7 @@ results in an indirect Clang invocation.
|
||||
)""",
|
||||
};
|
||||
|
||||
auto ClangOptions::Build(CommandLine::CommandBuilder& b) -> void {
|
||||
b.AddStringPositionalArg(
|
||||
{
|
||||
.name = "ARG",
|
||||
.help = R"""(
|
||||
Arguments passed to Clang.
|
||||
)""",
|
||||
},
|
||||
[&](auto& arg_b) { arg_b.Append(&args); });
|
||||
}
|
||||
ClangSubcommand::ClangSubcommand() : DriverSubcommand(SubcommandInfo) {}
|
||||
|
||||
// TODO: This lacks a lot of features from the main driver code. We may need to
|
||||
// add more.
|
||||
|
||||
Reference in New Issue
Block a user