MCPcopy Create free account
hub / github.com/duckdb/duckdb / ShowHelp

Function ShowHelp

tools/shell/shell_metadata_command.cpp:219–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219MetadataResult ShowHelp(ShellState &state, const vector<string> &args) {
220 if (args.size() >= 2) {
221#ifdef HAVE_LINENOISE
222 if (duckdb::StringUtil::CIEquals(args[1], "shortcuts")) {
223 auto shortcuts = duckdb::GetShellShortcuts();
224 const char *current_category = nullptr;
225 for (auto &entry : shortcuts) {
226 if (!current_category || strcmp(current_category, entry.category) != 0) {
227 if (current_category) {
228 state.PrintF("\n");
229 }
230 current_category = entry.category;
231 duckdb_shell::ShellHighlight highlighter(state);
232 highlighter.PrintText(entry.category, PrintOutput::STDOUT, HighlightElementType::KEYWORD);
233 state.PrintF("\n");
234 }
235 state.PrintF(" %-24s %s\n", entry.key_name, entry.description);
236 }
237 return MetadataResult::SUCCESS;
238 }
239#endif
240 idx_t n = state.PrintHelp(args[1].c_str());
241 if (n == 0) {
242 state.PrintF("Nothing matches '%s'\n", args[1].c_str());
243 }
244 } else {
245 state.PrintHelp(0);
246 }
247 return MetadataResult::SUCCESS;
248}
249
250MetadataResult RenderLastResult(ShellState &state, const vector<string> &args) {
251 if (state.last_result) {

Callers

nothing calls this directly

Calls 6

GetShellShortcutsFunction · 0.85
PrintHelpMethod · 0.80
c_strMethod · 0.80
sizeMethod · 0.45
PrintFMethod · 0.45
PrintTextMethod · 0.45

Tested by

no test coverage detected