diff --git a/home/jashton.nix b/home/jashton.nix index cc1c228..a73f59b 100644 --- a/home/jashton.nix +++ b/home/jashton.nix @@ -84,22 +84,15 @@ in '') (pkgs.writeShellScriptBin "jbuild" '' - set -euo pipefail - if [ $# -lt 1 ]; then - echo "usage: jbuild [args...]" >&2 - exit 1 - fi - ROOT="$(jroot)" cd "$ROOT" mkdir -p bin # Set the target directory, defaulting to the current directory (.) if $1 is empty - TARGET_DIR="$1" SOURCES_FILE="SOURCES" # Fix the find command to safely search the target directory - find "$TARGET_DIR" -name '*.java' > "$SOURCES_FILE" + find . -name '*.java' > "$SOURCES_FILE" if [ ! -s "$SOURCES_FILE" ]; then # Fix the error message to reference the directory, not the output text file @@ -119,30 +112,23 @@ in (pkgs.writeShellScriptBin "jclean" '' set -euo pipefail ROOT="$(jroot)" - rm -rf "$ROOT/bin" + rm -rf "$ROOT/bin/*" echo "cleaned $ROOT/bin" '') (pkgs.writeShellScriptBin "jrun" '' - set -euo pipefail if [ $# -lt 3 ]; then - echo "usage: jrun [args...]" >&2 + echo "usage: jrun [args...]" >&2 exit 1 fi ROOT="$(jroot)" cd "$ROOT" - jbuild "$1" MAIN="$2.$3" - shift 3 + shift 2 java -cp "bin:lib/*" "$MAIN" "$@" '') (pkgs.writeShellScriptBin "jtest" '' - if [ "$#" -neq 1 ]; then - echo "usage: jtest " - exit 1 - fi - # sort -V so 1.10.2 beats 1.9.0; plain tail -n1 sorts those the wrong way. JUNIT="$(ls -1 "$HOME"/dev/jars/junit-platform-console-standalone-*.jar 2>/dev/null | sort -V | tail -n1 || true)" if [ -z "$JUNIT" ]; then