#!/bin/sh # run_cargo.sh project {build|check|clean|test} {debug|release} target=x86_64-unknown-linux-gnu if [ -n "${CARGO_RUN_ARGS}" ]; then run_args=-- ${CARGO_RUN_ARGS} fi cd $1 if [ $2 = build ]; then echo "cargo build $1 --$3" $HOME/.cargo/bin/cargo build --$3 --target=$target if [ $? = 0 ]; then cp target/$target/$3/$1 ../../../bin echo "1 File(s) copied" fi exit $? elif [ $2 = run ]; then echo "cargo run $1 --$3" $HOME/.cargo/bin/cargo run --$3 --target=$target exit $? elif [ $2 = check ]; then echo "cargo check $1 --$3" $HOME/.cargo/bin/cargo check --$3 --target=$target $run_args exit $? elif [ $2 = clean ]; then echo "cargo clean $1" $HOME/.cargo/bin/cargo clean exit $? else echo "Unkown cargo command $2 for project $1" fi