diff options
Diffstat (limited to 'scripts/check-consistency.sh')
| -rwxr-xr-x | scripts/check-consistency.sh | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/scripts/check-consistency.sh b/scripts/check-consistency.sh index 3ca9b0c..d8054e2 100755 --- a/scripts/check-consistency.sh +++ b/scripts/check-consistency.sh @@ -6,7 +6,10 @@ # "Command", and vice versa; # 2. every error code passed to fail()/failf()/add_error() in src/*.c is # documented in PROTOCOL.md section 5.3, and vice versa (documented but -# unused codes are warnings only, some are reserved). +# unused codes are warnings only, some are reserved); +# 3. the TUI uses no key a browser terminal cannot deliver: no function +# keys (KEY_F), no Ctrl+N and no Ctrl+Enter (docs/TUI-GUIDELINES.md +# "Keys and the web"). # # Run from the repo root: sh scripts/check-consistency.sh # Exits 0 when there is no drift, 1 when drift is found, 2 on parse errors. @@ -19,6 +22,8 @@ # PROTOCOL_MD protocol document, default $REPO_ROOT/docs/PROTOCOL.md # SRC_GLOB shell glob of sources scanned for error codes, # default $REPO_ROOT/src/*.c +# CLIENTS_GLOB shell glob of TUI sources scanned for keys, +# default $REPO_ROOT/clients/*.c # # Commands deliberately kept out of the PROTOCOL.md tables. Prefer documenting # the command in a table over adding it here. Keep sorted, space separated. @@ -188,6 +193,24 @@ else echo "(none)" fi +section "keys: F-keys, Ctrl+N or Ctrl+Enter used in the TUI" +CLIENTS_GLOB=${CLIENTS_GLOB:-"$REPO_ROOT/clients/*.c"} +: > "$tmp/bad_keys" +for f in $CLIENTS_GLOB; do + [ -f "$f" ] || continue + grep -nE 'KEY_F\(|TUI_KEY_CTRL_N|KEY_CTRL_N|CTRL_ENTER' "$f" | + sed "s|^|$f:|" >> "$tmp/bad_keys" || true +done +if [ -s "$tmp/bad_keys" ]; then + while IFS= read -r line; do + echo "key: not web-safe: $line" + problems=$((problems + 1)) + done < "$tmp/bad_keys" + status=1 +else + echo "(none)" +fi + section "warnings (not failures)" if [ -s "$tmp/code_unused" ]; then while IFS= read -r code; do |
