dots2/.antidote/functions/__antidote_collect_input

15 lines
325 B
Bash

#!/bin/zsh
### Collect <redirected or piped| input
#function __antidote_collect_input {
local -a input=()
if (( $# > 0 )); then
input=("${(s.\n.)${@}}")
elif [[ ! -t 0 ]]; then
local data
while IFS= read -r data || [[ -n "$data" ]]; do
input+=("$data")
done
fi
printf '%s\n' "${input[@]}"
#}