#!/bin/bash do_code() { background=$1 find java/org/artisanlogiciel/games/ -name "*.java" | { s=() while read codeline do javafile=$(basename "$codeline") javaclass=${javafile/.java/} echo "$javafile $javaclass" s+=("$javaclass" "$codeline") done javaclass=$($DIALOG --menu "Edit it" 20 100 10 ${s[@]} 3>&1 1>&2 2>&3) if [[ -n $javaclass ]] then pushd java if [[ $background == codebg ]] then nohup make work/$javaclass & else make work/$javaclass fi popd fi } } possible_console_gui="whiptail dialog" for DIALOG in $possible_console_gui do DIALOG=$(which $DIALOG) if [[ -n $DIALOG ]] then break fi done if [[ -z $DIALOG ]] then echo "no console gui support (within $possible_console_gui) => no menus " exit 1 fi action=initial while [[ $action != quit ]] do action=$($DIALOG --menu "Ultra Light IDE" 20 80 8 run "Run it" clean "Clean All" ant "Ant build" test "Test it" readme "Read me" code "Code" codebg "Code in background" deb "Debian package" quit "Quit" 3>&1 1>&2 2>&3) if [[ $action == run ]] then echo "run it" java -jar $(make getname) elif [[ $action == ant ]] then make clean make ant compile elif [[ $action == clean ]] then make clean pushd java make clean popd elif [[ $action == test ]] then echo "test it" pushd java make display popd elif [[ $action == deb ]] then make deb elif [[ $action =~ code ]] then do_code $action elif [[ $action == readme ]] then $DIALOG --textbox README 20 80 fi done