Switch to using newlines as separator between completions

pull/5/head
Lennart Spitzner 2018-01-12 00:08:26 +01:00
parent 327f596d1d
commit 9337ab8d40
1 changed files with 3 additions and 3 deletions

View File

@ -126,7 +126,7 @@ addShellCompletionCommand mainCmdParser = do
let lastWord =
reverse $ takeWhile (not . Char.isSpace) $ reverse $ inputString
rest
putStrLn $ List.intercalate "\t" $ compls <&> \case
putStrLn $ List.unlines $ compls <&> \case
CompletionString s -> s
CompletionFile -> "$(compgen -f -- " ++ lastWord ++ ")"
CompletionDirectory -> "$(compgen -d -- " ++ lastWord ++ ")"
@ -149,13 +149,13 @@ completionScriptBash exeName =
List.unlines
$ [ "function _" ++ exeName ++ "()"
, "{"
, " local IFS=$'\\t'"
, " local IFS=$'\\n'"
, " COMPREPLY=()"
, " local result=$("
++ exeName
++ " completion bash-gen \"${COMP_WORDS[@]:1}\")"
, " for r in ${result[@]}; do"
, " local IFS=$'\\n\\t '"
, " local IFS=$'\\n '"
, " for s in $(eval echo ${r}); do"
, " COMPREPLY+=(${s})"
, " done"