1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
#
# Wrapper script that tries to discover runtimes and add them to `PATH` before
# then executing the command passed in. For example:
#
# $ cargo run runtimes
# => 14.2 /usr/local/bin
#
# $ ./with-runtimes cargo run runtimes
# 9.4.26 /usr/local/Cellar/postgresql@9.4/9.4.26/bin
# 9.5.25 /usr/local/Cellar/postgresql@9.5/9.5.25/bin
# 10.20 /usr/local/Cellar/postgresql@10/10.20_1/bin
# 11.15 /usr/local/Cellar/postgresql@11/11.15_1/bin
# 12.10 /usr/local/Cellar/postgresql@12/12.10_1/bin
# 13.6 /usr/local/Cellar/postgresql@13/13.6_1/bin
# => 14.2 /usr/local/bin
#
# Note that it adds runtime paths to the _end_ of PATH so that the default
# runtime is not affected.
#
# Debian/Ubuntu.
if
then
PATH=" :"
# Homebrew.
elif
then
# The most recent version of PostgreSQL – typically installed by the
# `postgresql` formula – links `pg_ctl` et al. into `$prefix/bin`, and has a
# Cellar path of `$prefix/Cellar/postgresql` (note: no @version). We
# specifically do not match it here otherwise it'll be discovered twice and
# tests, for example, will take longer.
PATH=" :"
fi
# Make sure it's exported. It really should be, but let's be super sure.
# Execute whatever we got passed in.