Skip to content

Commit

Permalink
Display example names in 2 columns
Browse files Browse the repository at this point in the history
- ported from ba28679
  • Loading branch information
trustin committed May 22, 2014
1 parent 00853d9 commit a99371a
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions run-example.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash -e
EXAMPLE_MAP=(
'spdy-server:io.netty.example.spdy.server.SpdyServer'
'spdy-client:io.netty.example.spdy.client.SpdyClient'
'http2-server:io.netty.example.http2.server.Http2Server'
'spdy-server:io.netty.example.spdy.server.SpdyServer'
'http2-client:io.netty.example.http2.client.Http2Client'
'http2-server:io.netty.example.http2.server.Http2Server'
)

EXAMPLE=''
Expand Down Expand Up @@ -37,14 +37,28 @@ if [[ -z "$EXAMPLE" ]] || [[ -z "$EXAMPLE_CLASS" ]] || [[ $# -ne 0 ]]; then
echo >&2
echo "Available examples:" >&2
echo >&2
I=0
for E in "${EXAMPLE_MAP[@]}"; do
echo " ${E%%:*}"
done | sort >&2
if [[ $I -eq 0 ]]; then
echo -n ' '
fi

printf '%-24s' "${E%%:*}"
((I++)) || true

if [[ $I -eq 2 ]]; then
I=0
echo
fi
done >&2
if [[ $I -ne 0 ]]; then
echo >&2
fi
echo >&2
exit 1
fi

cd "`dirname "$0"`"/example
cd "`dirname "$0"`"
echo "[INFO] Running: $EXAMPLE ($EXAMPLE_CLASS $EXAMPLE_ARGS)"
exec mvn -nsu compile exec:exec -DargLine.example="$EXAMPLE_ARGS" -DexampleClass="$EXAMPLE_CLASS"

0 comments on commit a99371a

Please sign in to comment.