-
Notifications
You must be signed in to change notification settings - Fork 1
/
auto.sh
49 lines (35 loc) · 996 Bytes
/
auto.sh
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
#!/usr/bin/env bash
export PROJDIR=${PROJDIR:-$(git rev-parse --show-toplevel)}
export IN_NIX_SHELL=${IN_NIX_SHELL:-nopes}
export CARGO_HOME="${PROJDIR}/.cargo";
export PATH=${CARGO_HOME}/bin:${PROJDIR}/venv/bin:$PATH
nn() {
echo "in_nix:" "${IN_NIX_SHELL}"
}
setup() {
pushd2 /
test -f venv/bin/python || python -m venv venv
test -f venv/bin/pre-commit || pip install -r requirements.txt
test -f .git/hooks/pre-commit || pre-commit install
mkdir -p .cargo;
popd2
}
pushd2() {
PUSHED=$(pwd)
cd "${PROJDIR}""$1" >> /dev/null || return
}
popd2() {
cd "${PUSHED:-$PROJDIR}" >> /dev/null || return
unset PUSHED
}
o() {
cd "${PROJDIR}" || return
}
alias open=/usr/bin/open
alias pbcopy=/usr/bin/pbcopy
alias gst="git status"
alias gd="git diff"
alias gp="git push"
alias cc="cargo fmt && cargo check"
# alias fix_cargo="find . | grep Cargo.toml | grep -v .cargo | grep -v target-nix | grep -v venv | xargs -n 1 cargo tomlfmt --path"
setup