-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrustx
More file actions
executable file
·49 lines (36 loc) · 835 Bytes
/
rustx
File metadata and controls
executable file
·49 lines (36 loc) · 835 Bytes
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
45
46
47
48
49
#!/bin/sh
NU_VERSION=$(cat $(dirname $0)/.nu_version)
os=$(uname -s)
arch=$(uname -m)
case "$os" in
"Darwin")
[ "$arch" = "arm64" ] && arch="aarch64"
native_nu="nu-${NU_VERSION}-${arch}-apple-darwin"
;;
"Linux")
native_nu="nu-${NU_VERSION}-${arch}-unknown-linux-musl"
;;
*)
echo "Unsupported operating system: $os" >&2
exit 1
;;
esac
linux_nu="nu-${NU_VERSION}-${arch}-unknown-linux-musl"
fetch_nu() {
name="$1"
mkdir -p build/
cd build/
wget "https://github.com/nushell/nushell/releases/download/$NU_VERSION/$name.tar.gz"
tar -zxvf ${name}.tar.gz $name/nu
rm ${name}.tar.gz
cd -
}
if [ ! -f build/$native_nu/nu ]; then
fetch_nu "$native_nu"
fi
if [ ! -f build/$linux_nu/nu ]; then
fetch_nu "$linux_nu"
fi
script="$(dirname "$0")/src/commands/$1.nu"
shift
exec build/$native_nu/nu $script "$@"