mirror of
https://github.com/XAMPPRocky/tokei
synced 2024-10-12 10:53:41 +00:00
e608b7d344
SC2086: Double quote to prevent globbing and word splitting. SC2162: read without -r will mangle backslashes
50 lines
997 B
Bash
Executable file
50 lines
997 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
if [ "$1" = "--full" ]; then
|
|
FILE=$2
|
|
FULL=true
|
|
else
|
|
FILE=$1
|
|
FULL=false
|
|
fi
|
|
|
|
echo 'Tokei Benchmarking Tool'
|
|
|
|
if [ $FULL = true ]; then
|
|
REQUIRED='cloc, tokei, loc, hyperfine, and scc'
|
|
else
|
|
REQUIRED='tokei, and hyperfine'
|
|
fi
|
|
|
|
echo "The use of this tool requires $REQUIRED to be installed and available in your PATH variable."
|
|
|
|
echo 'Please enter the path you would like to benchmark:'
|
|
|
|
if [ -z ${FILE+x} ]; then
|
|
read -r input
|
|
else
|
|
input=$FILE
|
|
fi
|
|
|
|
hyperfine --version
|
|
echo "old tokei: $(tokei --version)"
|
|
|
|
if [ $FULL = true ]; then
|
|
scc --version
|
|
loc --version
|
|
echo "cloc: $(cloc --version)"
|
|
fi
|
|
|
|
cargo build --release
|
|
|
|
if [ $FULL = true ]; then
|
|
hyperfine -w 10 --export-csv './results.csv' "target/release/tokei $input" \
|
|
"tokei $input" \
|
|
"scc $input" \
|
|
"loc $input" # \ "cloc $input"
|
|
else
|
|
hyperfine -w 5 "target/release/tokei $input" \
|
|
"tokei $input"
|
|
fi
|