diff --git a/src/help_text_formatter.cc b/src/help_text_formatter.cc index 3c54ad7b..83e8ed31 100644 --- a/src/help_text_formatter.cc +++ b/src/help_text_formatter.cc @@ -145,6 +145,11 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out, .append(param.ht_flag_name, &view_curses::VC_STYLE, A_BOLD); } + if (param.ht_group_start) { + out.ensure_space() + .append(param.ht_group_start, &view_curses::VC_STYLE, + A_BOLD); + } if (param.ht_name[0]) { out.ensure_space() .append(param.ht_name, &view_curses::VC_STYLE, @@ -199,6 +204,11 @@ void format_help_text_for_term(const help_text &ht, int width, attr_line_t &out, } out.append("]"); } + if (param.ht_group_end) { + out.ensure_space() + .append(param.ht_group_end, &view_curses::VC_STYLE, + A_BOLD); + } if (param.ht_nargs == HN_ZERO_OR_MORE || param.ht_nargs == HN_OPTIONAL) { out.append("]"); diff --git a/src/help_text_formatter.hh b/src/help_text_formatter.hh index ae178514..6dd23480 100644 --- a/src/help_text_formatter.hh +++ b/src/help_text_formatter.hh @@ -72,6 +72,8 @@ struct help_text { const char *ht_name; const char *ht_summary; const char *ht_flag_name{nullptr}; + const char *ht_group_start{nullptr}; + const char *ht_group_end{nullptr}; const char *ht_description{nullptr}; std::vector ht_parameters; std::vector ht_results; @@ -125,6 +127,12 @@ struct help_text { return *this; } + help_text &with_grouping(const char *group_start, const char *group_end) { + this->ht_group_start = group_start; + this->ht_group_end = group_end; + return *this; + } + help_text &with_parameters(const std::initializer_list ¶ms) { this->ht_parameters = params; for (auto ¶m : this->ht_parameters) { diff --git a/src/lnav_commands.cc b/src/lnav_commands.cc index f08c9e60..f8a7e552 100644 --- a/src/lnav_commands.cc +++ b/src/lnav_commands.cc @@ -3694,6 +3694,7 @@ readline_context::command_t STD_COMMANDS[] = { .with_parameter(help_text("timestamp", "The new timestamp for the top line in the view") .with_format(HPF_DATETIME)) .with_example({"2017-01-02T05:33:00", ""}) + .with_example({"-1h"}) }, { diff --git a/src/sqlite-extension-func.cc b/src/sqlite-extension-func.cc index 30cff19d..d8702ce1 100644 --- a/src/sqlite-extension-func.cc +++ b/src/sqlite-extension-func.cc @@ -592,6 +592,22 @@ int register_sqlite_funcs(sqlite3 *db, sqlite_registration_func_t *reg_funcs) .optional()) .with_parameter(help_text("trigger-name")), + help_text("INSERT", "Insert rows into a table") + .sql_keyword() + .with_parameter(help_text("") + .with_flag_name("INTO")) + .with_parameter(help_text("schema-name.") + .optional()) + .with_parameter(help_text("table-name")) + .with_parameter(help_text("column-name") + .with_grouping("(", ")") + .zero_or_more()) + .with_parameter(help_text("expr") + .with_flag_name("VALUES") + .with_grouping("(", ")") + .one_or_more()) + .with_example({"INSERT INTO environ VALUES ('MSG', 'HELLO, WORLD!')"}), + help_text("SELECT", "Query the database and return zero or more rows of data.") .sql_keyword() diff --git a/test/expected_help.txt b/test/expected_help.txt index 2e53589d..60071517 100644 --- a/test/expected_help.txt +++ b/test/expected_help.txt @@ -2135,6 +2135,18 @@ Synopsis Parameters +Synopsis + INSERT INTO [schema-name.] table-name [( column-name1 [, ... column-nameN] )] + VALUES ( expr1 [, ... exprN] ) + + Insert rows into a table +Parameters + +Example +#1 ;INSERT INTO environ VALUES ('MSG', 'HELLO, WORLD!') + + + Synopsis SELECT result-column1 [, ... result-columnN] [FROM table1 [, ... tableN]] [WHERE cond]