diff --git a/xff/cli/help.cc b/xff/cli/help.cc index 737db44..9dde6f1 100644 --- a/xff/cli/help.cc +++ b/xff/cli/help.cc @@ -223,16 +223,6 @@ absl::Span 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 @@ -455,9 +445,6 @@ absl::StatusOr 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 } diff --git a/xff/cli/help_build.cc b/xff/cli/help_build.cc index 80c7516..31192b3 100644 --- a/xff/cli/help_build.cc +++ b/xff/cli/help_build.cc @@ -529,6 +529,8 @@ std::optional 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; } diff --git a/xff/cli/help_render_test.cc b/xff/cli/help_render_test.cc index 9e70dd0..233c474 100644 --- a/xff/cli/help_render_test.cc +++ b/xff/cli/help_render_test.cc @@ -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 rendered = RenderHelp(topic.name); diff --git a/xff/cli/help_topic_test.sh b/xff/cli/help_topic_test.sh index bfbdeba..c600940 100755 --- a/xff/cli/help_topic_test.sh +++ b/xff/cli/help_topic_test.sh @@ -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