Skip to content
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

Don't format options table like errors #1306

Merged
merged 5 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/vcpkg/vcpkgcmdarguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ namespace vcpkg
LocalizedString get_example_text() const;
};

void print_usage(const CommandMetadata& command_metadata);
LocalizedString usage_for_command(const CommandMetadata& command_metadata);

struct FeatureFlagSettings
{
Expand Down Expand Up @@ -412,7 +412,7 @@ namespace vcpkg

Optional<StringLiteral> m_detected_ci_environment;

friend void print_usage(const CommandMetadata& command_metadata);
friend LocalizedString usage_for_command(const CommandMetadata& command_metadata);
CmdParser parser;
};
}
2 changes: 1 addition & 1 deletion src/vcpkg/commands.help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ namespace vcpkg
{
if (Strings::case_insensitive_ascii_equals(command_metadata->name, topic))
{
print_usage(*command_metadata);
msg::print(usage_for_command(*command_metadata));
get_global_metrics_collector().track_string(StringMetric::CommandContext, command_metadata->name);
Checks::exit_success(VCPKG_LINE_INFO);
}
Expand Down
4 changes: 2 additions & 2 deletions src/vcpkg/commands.install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ namespace vcpkg
if (failure)
{
msg::println(msgUsingManifestAt, msg::path = p->path);
print_usage(CommandInstallMetadataManifest);
msg::print(usage_for_command(CommandInstallMetadataManifest));
Checks::exit_fail(VCPKG_LINE_INFO);
}

Expand All @@ -1110,7 +1110,7 @@ namespace vcpkg
}
if (failure)
{
print_usage(CommandInstallMetadataClassic);
msg::write_unlocalized_text_to_stderr(Color::none, usage_for_command(CommandInstallMetadataClassic));
Checks::exit_fail(VCPKG_LINE_INFO);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/vcpkg/vcpkgcmdarguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ namespace vcpkg
return result;
}

void print_usage(const CommandMetadata& command_metadata)
LocalizedString usage_for_command(const CommandMetadata& command_metadata)
{
auto with_common_options = VcpkgCmdArguments::create_from_arg_sequence(nullptr, nullptr);
ParsedArguments throwaway;
Expand Down Expand Up @@ -517,7 +517,7 @@ namespace vcpkg

with_common_options.parser.append_options_table(result);
result.append_raw('\n');
msg::write_unlocalized_text_to_stderr(Color::error, result);
return result;
}

static void from_env(const std::function<Optional<std::string>(ZStringView)>& f,
Expand Down