This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.juste_wrapper
executable file
·52 lines (45 loc) · 1.68 KB
/
.juste_wrapper
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
50
51
52
#!/usr/bin/env bash
set -eu
JUSTE_DIR="${PWD}"
export PATH="${JUSTE_DIR}/linux:${PATH}"
if [ -n "${VSI_COMMON_DIR+set}" ] && [ ! -d "${VSI_COMMON_DIR}" ]; then
echo 'ERROR: the environment variable VSI_COMMON_DIR is set to a directory that does not exist;'
echo ' please either unset or correct it'
exit 1
fi
: "${VSI_COMMON_DIR="${JUSTE_DIR}"}"
# Go BACK to the original dir
cd "${USER_PWD}"
juste()
{
just ${@+"${@}"}
}
export -f juste
if [ "${OS-}" = "Windows_NT" ]; then
if [ "${JUST_FROZEN-}" = "1" ] || [ "${JUST_IS_TTY-}" = "1" ]; then
export JUST_FROZEN=1
exec just ${@+"${@}"}
else
stdin_name="$(powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "${VSI_COMMON_DIR}/windows/get_stdin_name.ps1")"
export JUST_FROZEN=1
if [ "${stdin_name}" = "None" ] || [[ ${stdin_name} != *-from-master ]]; then
# Even though a pipe isn't a TTY, I don't need a TTY, to mock the system
# by saying it is a tty
JUST_IS_TTY=1 exec just ${@+"${@}"}
else
. "${VSI_COMMON_DIR}/linux/just_functions.bsh"
export JUST_IS_TTY=1
JUST_PTY="${JUST_PTY-winpty}"
if [ "${JUST_PTY}" != "powershell" ] && command -v "${JUST_PTY}" &> /dev/null; then
${JUST_PTY} bash "$0" ${@+"${@}"}
exec ${JUST_PTY} bash --rcfile "${VSI_COMMON_DIR}/.winbashrc"
else
exec start powershell "cmd /c color 07; bash \"$0\" ${@}; bash --rcfile \"${VSI_COMMON_DIR}/.winbashrc\""
fi
# MSYS_NO_PATHCONV=1 cmd /c start /wait powershell "Remove-Item Env:\MSYS_NO_PATHCONV; cmd /c color 07; bash just ${@}; bash --rcfile \"${VSI_COMMON_DIR}/.winbashrc\""
fi
fi
else
export JUST_FROZEN=1
exec just ${@+"${@}"}
fi