1
1
mirror of https://github.com/tstack/lnav.git synced 2024-10-26 21:19:54 +03:00

[help] some online help additions

This commit is contained in:
Timothy Stack 2019-03-13 23:07:39 -07:00
parent 21c5c52843
commit 33cdbefaaa
5 changed files with 47 additions and 0 deletions

View File

@ -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("]");

View File

@ -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<struct help_text> ht_parameters;
std::vector<struct help_text> 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<help_text> &params) {
this->ht_parameters = params;
for (auto &param : this->ht_parameters) {

View File

@ -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"})
},
{

View File

@ -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()

View File

@ -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]