Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 0 additions & 13 deletions xff/cli/help.cc
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,6 @@ absl::Span<const Recipe> CookbookRecipes() {

namespace {

std::string RenderCookbook() {
std::string out =
"xff cookbook: worked examples that compose xff's building blocks. Each shows a task, the\n"
"command, and how it works. See --help=fields for {field}s and --help=stats for the reductions.\n";
for (const Recipe& recipe : CookbookRecipes()) {
absl::StrAppend(&out, "\n ", recipe.task, "\n ", recipe.command, "\n ", recipe.note, "\n");
}
return out;
}

// The `--help=licenses` topic: a minimum-viable license summary. xff's own license, the core
// libraries always linked in, and the build extras with whether THIS binary has them (via
// ExtraEnabled, so it reflects the actual build). Full notice texts live in the NOTICE file; this
Expand Down Expand Up @@ -455,9 +445,6 @@ absl::StatusOr<std::string> RenderHelp(std::string_view topic) {
if (topic == "expressions") {
return RenderExpressions(); // the annotated Tests/Actions/Operators list, sans globals
}
if (topic == "cookbook" || topic == "examples" || topic == "recipes") {
return RenderCookbook(); // worked examples composing the building blocks end to end
}
if (topic == "notice" || topic == "notices") {
return RenderNotice(); // third-party component manifest + what this binary contains
}
Expand Down
2 changes: 2 additions & 0 deletions xff/cli/help_build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ std::optional<Document> TopicReference(std::string_view name) {
doc.sections.push_back(StatsSection());
} else if (name == "config") {
doc.sections.push_back(ConfigSection());
} else if (name == "cookbook" || name == "examples" || name == "recipes") {
doc.sections.push_back(BuildExamples());
} else {
return std::nullopt;
}
Expand Down
2 changes: 1 addition & 1 deletion xff/cli/help_render_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ TEST_F(HelpTest, EveryAdvertisedTopicRendersAndAliasesAreSynonyms) {
for (const HelpTopic& topic : HelpTopics()) {
if (topic.name == "styles" || topic.name == "fields" || topic.name == "printf" || topic.name == "time"
|| topic.name == "size" || topic.name == "grammars" || topic.name == "extras" || topic.name == "stats"
|| topic.name == "config") {
|| topic.name == "config" || topic.name == "cookbook") {
continue; // rendered from the model (TopicReference) or the CLI facets, not RenderHelp
}
const absl::StatusOr<std::string> rendered = RenderHelp(topic.name);
Expand Down
2 changes: 1 addition & 1 deletion xff/cli/help_topic_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ test::help_cookbook_lists_worked_examples() {
# carries a runnable command. It also folds into --help=full.
local cookbook full
cookbook="$("$(_xff_bin)" --help=cookbook 2>&1)"
expect_output_contains 'xff cookbook' "${cookbook}"
expect_output_contains 'Worked examples' "${cookbook}"
expect_output_contains 'git blame' "${cookbook}" # the flagship -exec recipe
expect_output_contains 'xff . -type f --summary=ext' "${cookbook}" # a runnable command (global at the tail)
expect_output_contains 'Ten largest files' "${cookbook}" # a recipe task heading
Expand Down
Loading