/ scripts / dev / devimint-env.sh
devimint-env.sh
 1  #!/usr/bin/env bash
 2  
 3  set -euo pipefail
 4  
 5  source scripts/_common.sh
 6  
 7  ensure_in_dev_shell
 8  build_workspace
 9  add_target_dir_to_path
10  
11  export DEVIMINT_DIR="${CARGO_BUILD_TARGET_DIR:-target}/devimint"
12  rm -f "$DEVIMINT_DIR/devimint"
13  
14  function devimint_env {
15    set -euo pipefail
16  
17    export RUST_LOG=info
18    export RUST_BACKTRACE=1
19  
20    # For starship users, we can actually make the prompt distinct so there's
21    # no confusion.
22    export STARSHIP_CONFIG="${REPO_ROOT}/scripts/dev/devimint-env/starship.toml"
23  
24    >&2 echo "Devimint Env Shell Ready (exit to shutdown):"
25    if [ "$SHELL" == "fish" ] || [[ "$SHELL" == */fish ]]; then
26      "${SHELL}"
27    else
28      # posix shell users can tell they are in devimint-env
29      # because we customize the prompt
30      if [ -n "${PS1:-}" ]; then
31        PS1="[devimint] $PS1"
32      else
33        PS1="[devimint]"
34      fi
35  
36      "${SHELL}"
37    fi
38  }
39  export -f devimint_env
40  
41  env RUST_LOG="${RUST_LOG:-info,jsonrpsee-client=off}" \
42    devimint --link-test-dir "${CARGO_BUILD_TARGET_DIR:-$PWD/target}/devimint" "$@" dev-fed \
43      --exec bash -c devimint_env
44  
45  >&2 echo "Devimint Env Ended"