File: just.sh

package info (click to toggle)
rust-just 1.43.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 2,068 kB
  • sloc: sh: 300; makefile: 6
file content (33 lines) | stat: -rwxr-xr-x 645 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env bash

# cd upwards to the justfile
while [[ ! -e justfile ]]; do
  if [[ $PWD = / ]] || [[ $PWD = $JUSTSTOP ]] || [[ -e juststop ]]; then
    echo 'No justfile found.'
    exit 1
  fi
  cd ..
done

# prefer gmake if it exists
if command -v gmake > /dev/null; then
  MAKE=gmake
else
  MAKE=make
fi

declare -a RECIPES
for ARG in "$@"; do
  test $ARG =  '--'  && shift && break
  RECIPES+=($ARG) && shift
done

# export arguments after '--' so they can be used in recipes
I=0
for ARG in "$@"; do
    export ARG$I=$ARG
    I=$((I + 1))
done

# go!
exec $MAKE MAKEFLAGS='' --always-make --no-print-directory -f justfile ${RECIPES[*]}