Source

LWJGL Shader Tutorials / launch

Full commit
Chuck Adams e4169fd 












Chuck Adams f7af7ba 
Chuck Adams e4169fd 






















Chuck Adams 9159fa4 







Chuck Adams e4169fd 









#!/bin/bash

die () {
    echo -e "$*" >&2
    exit 1
}

mvn=$(which mvn)

[[ -z $mvn ]] && die "\n\n  Maven not found.  Please download it from http://maven.apache.org/download.html\n\n"

launch () {
    class=$1
    MAVEN_OPTS='-Djava.library.path=target/natives' mvn compile exec:java -Dexec.mainClass=$class
}

get_targets () {
    expr=$1
    grep -rl 'public static void main' src/main/java \
        | sed 's/\//./g; s/\.java$//; s/^src\.main.java\.//' \
        | grep $expr
}

expr=${1:-.}

declare -a targets=($(get_targets $expr))
len=${#targets[@]}
if [[ $len = 0 ]]; then
    echo "No targets found for $expr"
elif [[ $len -gt 1 ]]; then
    echo -e "Found $len matching targets.  Choose one:\n"
    read -p "$(
    i=0
    for t in ${targets[@]}
    do
        printf "%3d) %s\n" $((++i)) $t
    done
    if [[ $expr = . ]]; then
        echo ""
        echo "Hint: you can narrow down this list by passing part of the name"
        echo "      as an argument next time you launch."
        echo ""
        echo "Example:  $0 arcsyn"
        echo ""
    fi
    echo -ne "\nSelect one: "
    )" selection
    selected="${targets[$((selection-1))]}"

    [[ -z "$selected" ]] && die "No target selected."
    launch $selected
    exit 1
else
    launch ${targets[0]}
fi