Commit 6d333dfa0d24fbb9481cb7b159834ec4271f2f7a

Authored by Shrikant Sharat
1 parent 620c89d5b4

Fix #20. Using `sed -r` breaks antigen on Mac.

The BSD version of `sed` apparently does not have the `-r` option. So,
eliminated the use of `sed` in this place altogather.

Showing 1 changed file with 11 additions and 1 deletions Side-by-side Diff

... ... @@ -418,7 +418,17 @@ antigen () {
418 418 done
419 419  
420 420 local keyword_args="$(
421   - echo "$positional_args" | tr , '\n' | sed -r 's/(\??)$/:\1/'
  421 + # Positional arguments can double up as keyword arguments too.
  422 + echo "$positional_args" | tr , '\n' |
  423 + while read line; do
  424 + if [[ $line == *\? ]]; then
  425 + echo "${line%?}:?"
  426 + else
  427 + echo "$line:"
  428 + fi
  429 + done
  430 +
  431 + # Specified keyword arguments.
422 432 echo "$spec" | cut -d\; -f2 | tr , '\n'
423 433 )"
424 434 local keyword_args_count="$(echo $keyword_args | awk -F, '{print NF}')"