fwt_software/include/fgc/HelpText.h

36 lines
1.2 KiB
C++

#pragma once
#include <string>
#include <vector>
namespace fgc {
// Operator command reference, modelled as data so the headless console and the
// TUI render from one source of truth (avoids the two drifting apart). The
// console prints renderHelp(); the TUI walks helpCatalog() to draw its inline
// help pane.
struct HelpEntry {
std::string syntax; // e.g. "goto <yaw_deg> <pitch_deg>"
std::string summary; // one-line description
std::vector<std::string> detail; // expanded lines: examples, units, notes
};
struct HelpSection {
std::string title; // e.g. "Positioning"
std::string blurb; // one line under the title
std::vector<HelpEntry> entries;
};
// The full catalog (static, built once).
const std::vector<HelpSection>& helpCatalog();
// Flatten the catalog to printable lines for the console.
// topic == "" -> every section's title/blurb + one summary line per entry.
// topic == "<x>" -> the matching section(s)/entry(ies) with their detail lines.
// Matching is case-insensitive against section titles and the first token of
// each entry's syntax (the command verb).
std::vector<std::string> renderHelp(const std::string& topic = "");
} // namespace fgc