mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
bash: fix incorrect completion for '--key '
This commit is contained in:
@ -69,7 +69,7 @@ fn writeBashCompletions(writer: anytype) !void {
|
|||||||
|
|
||||||
try writer.writeAll(
|
try writer.writeAll(
|
||||||
\\
|
\\
|
||||||
\\_handleConfig () {
|
\\_handleConfig() {
|
||||||
\\ case "$prev" in
|
\\ case "$prev" in
|
||||||
\\
|
\\
|
||||||
);
|
);
|
||||||
@ -232,23 +232,23 @@ fn writeBashCompletions(writer: anytype) !void {
|
|||||||
try writer.writeAll(
|
try writer.writeAll(
|
||||||
\\
|
\\
|
||||||
\\_ghostty () {
|
\\_ghostty () {
|
||||||
\\ COMPREPLY=()
|
\\ cur=""; prev=""; prevWasEq=false; COMPREPLY=()
|
||||||
|
\\
|
||||||
\\ if [ "$2" = "=" ]; then cur=""
|
\\ if [ "$2" = "=" ]; then cur=""
|
||||||
\\ else cur="$2"
|
\\ else cur="$2"
|
||||||
\\ fi
|
\\ fi
|
||||||
\\
|
\\
|
||||||
\\ if [ "$3" = "=" ]; then prev="${COMP_WORDS[COMP_CWORD-2]}"
|
\\ if [ "$3" = "=" ]; then prev="${COMP_WORDS[COMP_CWORD-2]}"; prevWasEq=true;
|
||||||
\\ else prev="${COMP_WORDS[COMP_CWORD-1]}"
|
\\ else prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
\\ fi
|
\\ fi
|
||||||
\\
|
\\
|
||||||
|
\\ # current completion is double quoted add a space so the curor progresses
|
||||||
\\ if [[ "$2" == \"*\" ]]; then
|
\\ if [[ "$2" == \"*\" ]]; then
|
||||||
\\ COMPREPLY=( "$cur " );
|
\\ COMPREPLY=( "$cur " );
|
||||||
\\ return;
|
\\ return;
|
||||||
\\ fi
|
\\ fi
|
||||||
\\
|
\\
|
||||||
\\ cword=$COMP_CWORD
|
\\ case "$COMP_CWORD" in
|
||||||
\\
|
|
||||||
\\ case "$cword" in
|
|
||||||
\\ 1)
|
\\ 1)
|
||||||
\\ case "${COMP_WORDS[1]}" in
|
\\ case "${COMP_WORDS[1]}" in
|
||||||
\\ -e | --help | --version) return 0 ;;
|
\\ -e | --help | --version) return 0 ;;
|
||||||
@ -260,6 +260,12 @@ fn writeBashCompletions(writer: anytype) !void {
|
|||||||
\\ case "$prev" in
|
\\ case "$prev" in
|
||||||
\\ -e | --help | --version) return 0 ;;
|
\\ -e | --help | --version) return 0 ;;
|
||||||
\\ *)
|
\\ *)
|
||||||
|
\\ if [[ "=" != "${COMP_WORDS[COMP_CWORD]}" && $prevWasEq != true ]]; then
|
||||||
|
\\ # must be completing with a space after the key eg: '--<key> '
|
||||||
|
\\ # clear out prev so we don't run any of the key specific completions
|
||||||
|
\\ prev=""
|
||||||
|
\\ fi
|
||||||
|
\\
|
||||||
\\ case "${COMP_WORDS[1]}" in
|
\\ case "${COMP_WORDS[1]}" in
|
||||||
\\ --*) _handleConfig ;;
|
\\ --*) _handleConfig ;;
|
||||||
\\ +*) _handleActions ;;
|
\\ +*) _handleActions ;;
|
||||||
|
Reference in New Issue
Block a user