mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 10:31:03 +01:00
Refactor subcommand addition for sharing. (#4474)
Trying to standardize the setup a little more.
This commit is contained in:
@@ -14,13 +14,6 @@
|
||||
|
||||
namespace Carbon {
|
||||
|
||||
constexpr CommandLine::CommandInfo FormatOptions::Info = {
|
||||
.name = "format",
|
||||
.help = R"""(
|
||||
Format Carbon source code.
|
||||
)""",
|
||||
};
|
||||
|
||||
auto FormatOptions::Build(CommandLine::CommandBuilder& b) -> void {
|
||||
b.AddStringPositionalArg(
|
||||
{
|
||||
@@ -49,6 +42,15 @@ Not valid when multiple files are passed for formatting.
|
||||
[&](auto& arg_b) { arg_b.Set(&output_filename); });
|
||||
}
|
||||
|
||||
static constexpr CommandLine::CommandInfo SubcommandInfo = {
|
||||
.name = "format",
|
||||
.help = R"""(
|
||||
Format Carbon source code.
|
||||
)""",
|
||||
};
|
||||
|
||||
FormatSubcommand::FormatSubcommand() : DriverSubcommand(SubcommandInfo) {}
|
||||
|
||||
auto FormatSubcommand::Run(DriverEnv& driver_env) -> DriverResult {
|
||||
DriverResult result = {.success = true};
|
||||
if (options_.input_filenames.size() > 1 &&
|
||||
|
||||
Reference in New Issue
Block a user