From 34094a0ccde92a03332c7ac6eab69463e13b0834 Mon Sep 17 00:00:00 2001 From: Maxwell Brown Date: Mon, 20 Nov 2023 15:45:23 -0500 Subject: [PATCH] fixup edge cases in bash completion script --- src/internal/cliApp.ts | 6 +----- src/internal/completion.ts | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/internal/cliApp.ts b/src/internal/cliApp.ts index ff24fd3..cd1db9b 100644 --- a/src/internal/cliApp.ts +++ b/src/internal/cliApp.ts @@ -197,11 +197,7 @@ const handleBuiltInOption = ( self.command, config, compgen - ).pipe( - Effect.flatMap((completions) => - Effect.forEach(completions, (word) => Console.log(word), { discard: true }) - ) - ) + ).pipe(Effect.flatMap(Effect.forEach((word) => Console.log(word), { discard: true }))) })) } case "ShowWizard": { diff --git a/src/internal/completion.ts b/src/internal/completion.ts index 9fb1f5e..2e92e8c 100644 --- a/src/internal/completion.ts +++ b/src/internal/completion.ts @@ -92,11 +92,11 @@ const createBashCompletionScript = ( |_${rootCommand}_effect_cli_completions() { | local CMDLINE | local IFS=$'\\n' - | CMDLINE=(--shell-type bash --shell-completion-index $COMP_CWORD) + | CMDLINE=(--shell-type bash --shell-completion-index "\${COMP_CWORD}") | | INDEX=0 - | for arg in \${COMP_WORDS[@]}; do - | export COMP_WORD_$INDEX=\${arg} + | for arg in "\${COMP_WORDS[@]}"; do + | export COMP_WORD_$INDEX="\${arg}" | (( INDEX++ )) | done |