Shell script nits (#4982)

This commit is contained in:
Jack May
2019-07-09 12:09:13 -08:00
committed by GitHub
parent 5e221bf219
commit bc8f435d45

View File

@ -3,19 +3,21 @@
cd "$(dirname "$0")" cd "$(dirname "$0")"
usage() { usage() {
echo "" cat <<EOF
echo " Usage: do.sh action <project>"
echo "" Usage: do.sh action <project>
echo " If relative_project_path is ommitted then action will"
echo " be performed on all projects" If relative_project_path is ommitted then action will
echo "" be performed on all projects
echo " Supported actions:"
echo " build" Supported actions:
echo " clean" build
echo " test" clean
echo " clippy" test
echo " fmt" clippy
echo "" fmt
EOF
} }
perform_action() { perform_action() {
@ -23,31 +25,31 @@ perform_action() {
case "$1" in case "$1" in
build) build)
./../../../sdk/bpf/rust/build.sh "$2" ./../../../sdk/bpf/rust/build.sh "$2"
;; ;;
clean) clean)
./../../../sdk/bpf/rust/clean.sh "$2" ./../../../sdk/bpf/rust/clean.sh "$2"
;; ;;
test) test)
( (
cd "$2" cd "$2"
echo "test $2" echo "test $2"
cargo +nightly test cargo +nightly test
) )
;; ;;
clippy) clippy)
( (
cd "$2" cd "$2"
echo "clippy $2" echo "clippy $2"
cargo +nightly clippy cargo +nightly clippy
) )
;; ;;
fmt) fmt)
( (
cd "$2" cd "$2"
echo "formatting $2" echo "formatting $2"
cargo fmt cargo fmt
) )
;; ;;
dump) dump)
# Dump depends on tools that are not installed by default and must be installed manually # Dump depends on tools that are not installed by default and must be installed manually
# - greadelf # - greadelf
@ -93,7 +95,7 @@ perform_action() {
echo "Error: Unknown command" echo "Error: Unknown command"
usage usage
exit exit
;; ;;
esac esac
} }