summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Allen <screwtape@froup.com>2020-02-09 14:01:35 +1100
committerTim Allen <screwtape@froup.com>2020-02-09 14:01:35 +1100
commit09f067d58552094d53c8a68a151cf8f08fad75dd (patch)
tree847d450d52f3952a0626c7ded828902be5ac97d0
parent673d0818239da9b3add1a6ecad0b025e881c09e6 (diff)
rc lint: More code-review comments.
Don't ask Kakoune to quote values we know can never contain shell-sensitive characters, and flatten the kakquote() function to a single line for ease of copy/pasting.
-rw-r--r--rc/tools/lint.kak20
1 files changed, 4 insertions, 16 deletions
diff --git a/rc/tools/lint.kak b/rc/tools/lint.kak
index ba6ea012..c23e41dd 100644
--- a/rc/tools/lint.kak
+++ b/rc/tools/lint.kak
@@ -37,11 +37,7 @@ define-command \
# Create a temporary directory to keep all our state.
evaluate-commands %sh{
# This is going to come in handy later.
- kakquote() {
- printf "'"
- printf "%s" "$*" | sed "s/'/''/g"
- printf "'"
- }
+ kakquote() { printf "%s" "$*" | sed "s/'/''/g; 1s/^/'/; \$s/\$/'/"; }
# Before we clobber our arguments,
# let's record the lintcmd we were given.
@@ -65,7 +61,7 @@ define-command \
}"
# Write all the selection descriptions to files.
- eval set -- "$kak_quoted_selections_desc"
+ eval set -- "$kak_selections_desc"
i=0
for desc; do
mkdir -p "$dir"/sel-"$i"
@@ -260,11 +256,7 @@ define-command \
evaluate-commands %sh{
# This is going to come in handy later.
- kakquote() {
- printf "'"
- printf "%s" "$*" | sed "s/'/''/g"
- printf "'"
- }
+ kakquote() { printf "%s" "$*" | sed "s/'/''/g; 1s/^/'/; \$s/\$/'/"; }
if [ "$1" = "-command" ]; then
if [ -z "$2" ]; then
@@ -307,11 +299,7 @@ define-command -hidden lint-show %{
update-option buffer lint_messages
evaluate-commands %sh{
# This is going to come in handy later.
- kakquote() {
- printf "'"
- printf "%s" "$*" | sed "s/'/''/g"
- printf "'"
- }
+ kakquote() { printf "%s" "$*" | sed "s/'/''/g; 1s/^/'/; \$s/\$/'/"; }
eval set -- "${kak_quoted_opt_lint_messages}"
shift # skip the timestamp