ruiu added inline comments.

================
Comment at: clang/utils/bash-autocomplete.sh:10
+  do
+    arg="$arg""${COMP_WORDS[$i]},"
+  done
----------------
ruiu wrote:
> nit: you don't need double double-quotes. Instead, `"$arg${COMP_WORDS[$i]}," 
> should just work.
On second thought, I think what you actually want to do is to concatenate the 
elements of the array with `,`, without adding `,` at end of the string. For 
example, if COMP_WORDS contains "a", "b" and "c", you want to create "a,b,c" 
instead of "a,b,c," or ",a,b,c".

There are surprisingly large number of different ways of doing this, but it 
seems this is one of the easiest ways.

  arg="$(IFS=,; echo "${COMP_WORDS[*]}")"

IFS is a special shell variable containing a word splitting words. By setting 
the variable, COMP_WORDS[*] is expanded to (for example) "a,b,c" instead of the 
default "a b c".


https://reviews.llvm.org/D33383



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to