[fx][run-test] Use the ## usage comment convention
This makes `fx help run-test` work.
Change-Id: I34ca2391715994575e3dc901f80c2b3a321d9169
diff --git a/devshell/run-test b/devshell/run-test
index 40f11f3..a48b13f 100755
--- a/devshell/run-test
+++ b/devshell/run-test
@@ -5,27 +5,30 @@
### build, copy to and run a test on target
+## usage: fx run-test TARGET [ARGS ...]
+## Builds the specified target (e.g., fxl_unittests), copies it to the
+## target, and executes it. Useful for tight iterations on unittests.
+
set -e
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"/lib/vars.sh
fx-config-read
function usage {
- cat <<END
-usage: fx run-test TARGET [ARGS ...]
-Builds the specified target (e.g., fxl_unittests), copies it to the target, and
-executes it. Useful for tight iterations on unittests.
-END
+ fx-command-help run-test
}
-if [[ $# -eq 0 ]]; then
- usage
- exit 1
-fi
+function main {
+ if [[ $# -eq 0 ]]; then
+ usage
+ return 1
+ fi
-target="$1"
+ target="$1"
+ fx-command-run build "${target}"
+ fx-command-run cp "${FUCHSIA_BUILD_DIR}/${target}" "/tmp/${target}"
+ shift
+ fx-command-run shell "/tmp/${target}" "$@"
+}
-fx-command-run build "${target}"
-fx-command-run cp "${FUCHSIA_BUILD_DIR}/${target}" "/tmp/${target}"
-shift
-fx-command-run shell "/tmp/${target}" "$@"
+main "$@"