Address code-review comments

- some wording changes in included documentation
- find supports multiple starting paths, we don't need to launch it 3 times
- Change the regex that trims the file extension to only trim the last extension

Some additional things I noticed:

- find should use -L to see through symlinks like the autoload processing does.
- find should check the user's autoload directory first, so users can override
  Kakoune's built-in documentation.
This commit is contained in:
Tim Allen 2020-09-03 15:06:24 +10:00
parent d628cb50cf
commit e3298c6320
3 changed files with 26 additions and 24 deletions

View File

@ -10,6 +10,6 @@
== Options == Options
*docsclient* (str):: *docsclient* (str)::
If set, the `:doc` command (and other commands that display documentation) If set, the `:doc` command will try to display documentation in the Kakoune
will try to display documentation in the Kakoune client with this name. client with this name.
See <<commands#clients-and-sessions,`:doc commands clients-and-sessions`>> See <<commands#clients-and-sessions,`:doc commands clients-and-sessions`>>

View File

@ -137,18 +137,20 @@ define-command -params 1 -hidden doc-render %{
define-command -params 1..2 \ define-command -params 1..2 \
-shell-script-candidates %{ -shell-script-candidates %{
if [ "$kak_token_to_complete" -eq 0 ]; then if [ "$kak_token_to_complete" -eq 0 ]; then
( find -L \
find "${kak_runtime}/doc/" -type f -name "*.asciidoc" "${kak_config}/autoload/" \
find "${kak_runtime}/rc/" -type f -name "*.asciidoc" "${kak_runtime}/doc/" \
find "${kak_config}/autoload/" -type f -name "*.asciidoc" "${kak_runtime}/rc/" \
) | sed 's,.*/,,; s/\.[^/]*$//' -type f -name "*.asciidoc" |
sed 's,.*/,,; s/\.[^.]*$//'
elif [ "$kak_token_to_complete" -eq 1 ]; then elif [ "$kak_token_to_complete" -eq 1 ]; then
page=$( page=$(
( find -L \
find "${kak_runtime}/doc/" -type f -name "$1.asciidoc" "${kak_config}/autoload/" \
find "${kak_runtime}/rc/" -type f -name "$1.asciidoc" "${kak_runtime}/doc/" \
find "${kak_config}/autoload/" -type f -name "$1.asciidoc" "${kak_runtime}/rc/" \
) | head -1 -type f -name "$1.asciidoc" |
head -1
) )
if [ -f "${page}" ]; then if [ -f "${page}" ]; then
awk ' awk '
@ -164,11 +166,12 @@ define-command -params 1..2 \
} %{ } %{
evaluate-commands %sh{ evaluate-commands %sh{
page=$( page=$(
( find -L \
find "${kak_runtime}/doc/" -type f -name "$1.asciidoc" "${kak_config}/autoload/" \
find "${kak_runtime}/rc/" -type f -name "$1.asciidoc" "${kak_runtime}/doc/" \
find "${kak_config}/autoload/" -type f -name "$1.asciidoc" "${kak_runtime}/rc/" \
) | head -1 -type f -name "$1.asciidoc" |
head -1
) )
if [ -f "${page}" ]; then if [ -f "${page}" ]; then
jump_cmd="" jump_cmd=""

View File

@ -1,8 +1,8 @@
= Integrate with tools that check files for problems. = Integrate with tools that check files for problems.
Many file-formats have "lint" tools that check for common problems and point out Many file-formats have "lint" tools that check for common problems and point out
where they occur. Most of these tools produce output in the the traditional where they occur. Most of these tools produce output in the traditional message
message format: format:
---- ----
{filename}:{line}:{column}: {kind}: {message} {filename}:{line}:{column}: {kind}: {message}
@ -15,7 +15,7 @@ This plugin can run such tools and collect the resulting messages. The complete
output is collected in the `*lint-output*` buffer, and any lines in the current output is collected in the `*lint-output*` buffer, and any lines in the current
file with messages will have a marker displayed next to them in the left margin. file with messages will have a marker displayed next to them in the left margin.
When the cursor moves onto a line with the problem, the associated messages will When the cursor moves onto a line with the problem, the associated messages will
be displayed in a tool tip.. be displayed in a tool tip.
== Commands == Commands
@ -46,12 +46,11 @@ be displayed in a tool tip..
The shell command used by lint-buffer and lint-selections. The shell command used by lint-buffer and lint-selections.
+ +
It will be given the path to a file containing the text to be It will be given the path to a file containing the text to be
linted, and must produce output in the format: linted, and must produce output in the format described above.
*toolsclient* (str):: *toolsclient* (str)::
If set, the `:lint` command (and other commands that point out files and If set, the `:lint` command will try to display its results in the Kakoune
line-numbers) will try to display its results in the Kakoune client with client with this name.
this name.
See <<commands#clients-and-sessions,`:doc commands clients-and-sessions`>> See <<commands#clients-and-sessions,`:doc commands clients-and-sessions`>>