mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
30 lines
595 B
Bash
Executable File
30 lines
595 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
swift_binary=swift
|
|
|
|
declare -a extra_args
|
|
extra_args=()
|
|
|
|
if [[ ! -z "${SWIFT_EXEC-}" ]]; then
|
|
swift_binary="$(dirname "$SWIFT_EXEC")/swift"
|
|
elif [[ "$(uname -s)" == "Linux" ]]; then
|
|
swift_binary=$(which swift)
|
|
fi
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
verb=repl
|
|
if [[ "$(uname -s)" == "Linux" ]]; then
|
|
# to work around not being able to import Foundation in the REPL
|
|
extra_args+="-I$(dirname "$swift_binary")/../lib/swift/clang/include/"
|
|
fi
|
|
else
|
|
verb="$1"
|
|
shift
|
|
fi
|
|
|
|
"$swift_binary" "$verb" \
|
|
${extra_args[@]+"${extra_args[@]}"} \
|
|
"$@"
|