| 217 | } |
| 218 | |
| 219 | MetadataResult 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 | |
| 250 | MetadataResult RenderLastResult(ShellState &state, const vector<string> &args) { |
| 251 | if (state.last_result) { |