mntime 0.1.1

The mntime command executes the specified "m" commands "n" times and calculates the mean "μ"(\mu) of usage time and memory.
Documentation
#!/bin/sh
set -e

ROOTDIR=$(cd "$(dirname "$0")" && pwd)
cd "$ROOTDIR"

# parse args
FIX=0
while [ "$1" != "" ]; do
    if [ "$1" = "--fix" ]; then
        FIX=1
    fi
    shift
done

# begin check
set -x

tools/check_readme.sh

cargo audit

cargo fmt

set +x
# cargo clippy returns exit code 0 even with warnings.
# However, I want to return error if exists warnings.
# In addition, warnings are printed even when --fix is specified.
set +e
exit_code=true
if cargo clippy 2>&1 | grep "warning:" > /dev/null; then
    if [ $FIX -eq 0 ]; then
        exit_code=false
    else
        # Later fix, but print warnings
        cargo clippy
    fi
fi
if [ $FIX -eq 0 ]; then
    CMD_CLIPPY="cargo clippy"
else
    CMD_CLIPPY="cargo clippy --fix --allow-dirty"
fi
set -e
set -x
$CMD_CLIPPY && $exit_code

cargo test

cargo doc

# cargo run --example demo