bash: document COMP_WORDBREAKS interaction

This commit is contained in:
Anund
2024-12-21 14:07:52 +11:00
parent 3f94c84c80
commit 9c96a80f8b

View File

@ -37,7 +37,6 @@ fn writeBashCompletions(writer: anytype) !void {
const pad4 = pad3 ++ pad1; const pad4 = pad3 ++ pad1;
try writer.writeAll( try writer.writeAll(
\\
\\# -o nospace requires we add back a space when a completion is finished \\# -o nospace requires we add back a space when a completion is finished
\\# and not part of a --key= completion \\# and not part of a --key= completion
\\addSpaces() { \\addSpaces() {
@ -281,6 +280,11 @@ fn writeBashCompletions(writer: anytype) !void {
\\ cur=""; prev=""; prevWasEq=false; COMPREPLY=() \\ cur=""; prev=""; prevWasEq=false; COMPREPLY=()
\\ ghostty="$1" \\ ghostty="$1"
\\ \\
\\ # script assumes default COMP_WORDBREAKS of roughly $' \t\n"\'><=;|&(:'
\\ # if = is missing this script will degrade to matching on keys only.
\\ # eg: --key=
\\ # this can be improved if needed see: https://github.com/ghostty-org/ghostty/discussions/2994
\\
\\ if [ "$2" = "=" ]; then cur="" \\ if [ "$2" = "=" ]; then cur=""
\\ else cur="$2" \\ else cur="$2"
\\ fi \\ fi