Skip to content

Commit e1ba8ac

Browse files
committed
[help] remove shell substitution pass on help text
Related to #1522
1 parent c35892e commit e1ba8ac

3 files changed

Lines changed: 17 additions & 24 deletions

File tree

src/help.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ On color displays, the lines will be highlighted as follows:
103103

104104
* Errors will be colored in <span class="-lnav_log-level-styles_error">red</span>;
105105
* warnings will be <span class="-lnav_log-level-styles_warning">yellow</span>;
106-
* boundaries between days will be ${ansi_underline}underlined${ansi_norm}; and
106+
* boundaries between days will be _underlined_; and
107107
* various color highlights will be applied to: IP addresses, SQL keywords,
108108
XML tags, file and line numbers in Java backtraces, and quoted strings.
109109

@@ -129,7 +129,7 @@ of information. The top line displays:
129129
The default message displayed on startup explains how to focus on the
130130
next status line at the top, which is an interactive breadcrumb bar.
131131

132-
The second status line at the top display breadcrumbs for the top line
132+
The second status line at the top displays breadcrumbs for the top line
133133
in the main view. Pressing `ENTER` will focus input on the breadcrumb
134134
bar, the cursor keys can be used to select a breadcrumb. The common
135135
breadcrumbs are:
@@ -267,13 +267,13 @@ that you can always use `q` to pop the top view off of the stack.
267267

268268
### Query
269269

270-
| Key(s) | Action |
271-
| -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
270+
| Key(s) | Action |
271+
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
272272
| **/**_regexp_ | Start a search for the given regular expression. The search is live, so when there is a pause in typing, the currently running search will be canceled and a new one started. The first ten lines that match the search will be displayed in the preview window at the bottom of the view. History is maintained for your searches so you can rerun them easily. Words that are currently displayed are also available for tab-completion, so you can easily search for values without needing to copy-and-paste the string. If there is an error encountered while trying to interpret the expression, the error will be displayed in red on the status line. While the search is active, the 'hits' field in the status line will be green, when finished it will turn back to black. |
273-
| **:**&lt;command&gt; | Execute an internal command. The commands are listed below. History is also supported in this context as well as tab-completion for commands and some arguments. The result of the command replaces the command you typed. |
274-
| **;**&lt;sql&gt; | Execute an SQL query. Most supported log file formats provide a sqlite virtual table backend that can be used in queries. See the SQL section below for more information. |
275-
| **&VerticalLine;**&lt;script&gt; [arg1...] | Execute an lnav script contained in a format directory (e.g. \~/.lnav/formats/default). The script can contain lines starting with `:`, `;`, or `\|` to execute commands, SQL queries or execute other files in lnav. Any values after the script name are treated as arguments can be referenced in the script using `\$1`, `\$2`, and so on, like in a shell script. |
276-
| CTRL+], ESCAPE | Abort command-line entry started with `/`, `:`, `;`, or `\|`. |
273+
| **:**&lt;command&gt; | Execute an internal command. The commands are listed below. History is also supported in this context as well as tab-completion for commands and some arguments. The result of the command replaces the command you typed. |
274+
| **;**&lt;sql&gt; | Execute an SQL query. Most supported log file formats provide a sqlite virtual table backend that can be used in queries. See the SQL section below for more information. |
275+
| **&VerticalLine;**&lt;script&gt; [arg1...] | Execute an lnav script contained in a format directory (e.g. \~/.lnav/formats/default). The script can contain lines starting with `:`, `;`, or `|` to execute commands, SQL queries or execute other files in lnav. Any values after the script name are treated as arguments can be referenced in the script using `$1`, `$2`, and so on, like in a shell script. |
276+
| CTRL+], ESCAPE | Abort command-line entry started with `/`, `:`, `;`, or `|`. |
277277

278278
> **Note**: The regular expression format used by lnav is
279279
> [PCRE](http://perldoc.perl.org/perlre.html)
@@ -502,26 +502,26 @@ template.
502502
## Other SQL Features
503503

504504
Environment variables can be used in SQL statements by prefixing the
505-
variable name with a dollar-sign (\$). For example, to read the value of
505+
variable name with a dollar-sign ($). For example, to read the value of
506506
the `HOME` variable, you can do:
507507

508508
```lnav
509-
;SELECT \$HOME;
509+
;SELECT $HOME;
510510
```
511511

512512
To select the syslog messages that have a hostname field that is equal
513513
to the `HOSTNAME` variable:
514514

515515
```lnav
516-
;SELECT * FROM syslog_log WHERE log_hostname = \$HOSTNAME;
516+
;SELECT * FROM syslog_log WHERE log_hostname = $HOSTNAME;
517517
```
518518

519519
NOTE: Variable substitution is done for fields in the query and is not
520520
a plain text substitution. For example, the following statement
521521
WILL NOT WORK:
522522

523523
```lnav
524-
;SELECT * FROM \$TABLE_NAME; -- Syntax error
524+
;SELECT * FROM $TABLE_NAME; -- Syntax error
525525
```
526526

527527
Access to lnav's environment variables is also available via the "environ"

src/view_helpers.cc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -593,15 +593,8 @@ build_all_help_text()
593593
}
594594

595595
auto help_md_str = help_md.to_string_fragment_producer()->to_string();
596-
shlex lexer(help_md_str);
597-
std::string sub_help_text;
598-
599-
lexer.with_ignore_quotes(true).eval(
600-
sub_help_text,
601-
scoped_resolver{&lnav_data.ld_exec_context.ec_global_vars});
602-
603596
md2attr_line mdal;
604-
auto parse_res = md4cpp::parse(sub_help_text, mdal);
597+
auto parse_res = md4cpp::parse(help_md_str, mdal);
605598
attr_line_t all_help_text = parse_res.unwrap();
606599

607600
std::map<std::string, const help_text*> sql_funcs;

test/expected/test_cmds.sh_b6a3bb78e9d60e5e1f5ce5b18e40d2f1662707ab.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ of information. The top line displays:
134134
focus on the next status line at the top, which is an
135135
interactive breadcrumb bar.
136136

137-
The second status line at the top display breadcrumbs for the top line
138-
in the main view. Pressing  ENTER  will focus input on the breadcrumb
139-
bar, the cursor keys can be used to select a breadcrumb. The common
140-
breadcrumbs are:
137+
The second status line at the top displays breadcrumbs for the top
138+
line in the main view. Pressing  ENTER  will focus input on the
139+
breadcrumb bar, the cursor keys can be used to select a breadcrumb.
140+
The common breadcrumbs are:
141141

142142
• The name of the current view.
143143
• In the log view, the timestamp of the top log message.

0 commit comments

Comments
 (0)