Skip to content

Commit

Permalink
make and bash-completion
Browse files Browse the repository at this point in the history
  • Loading branch information
maandree committed Jun 22, 2012
1 parent d03cb40 commit b98f1ee
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 10 deletions.
3 changes: 3 additions & 0 deletions META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Created-By: Mattias Andrée
Main-Class: se.kth.maandree.utilsay.Program
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
install:
javac -cp . -s src -d . src/se/kth/maandree/utilsay/*.java
jar -cfm util-say.jar META-INF/MANIFEST.MF se/kth/maandree/utilsay/*.class
rm -r se
./build.sh --build-scripts
install -d "${DESTDIR}/usr/bin"
install -m 755 util-say{,.jar} "${DESTDIR}/usr/bin"
install -d "${DESTDIR}/usr/share/bash-completion/completions"
install -m 644 share/bash-completion/completions/util-say "${DESTDIR}/usr/share/bash-completion/completions/util-say"

uninstall:
unlink "${DESTDIR}/usr/bin/util-say"
unlink "${DESTDIR}/usr/bin/util-say.jar"
unlink "${DESTDIR}/usr/share/bash-completion/completions/util-say"
37 changes: 27 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
#!/bin/sh

## completion
. run.sh --completion--
paramBuildScripts=0
for arg in $@; do
if [[ "$arg" = "--build-scripts" ]]; then
paramBuildScripts=1
fi
done

## create directory for Java binaries
mkdir bin 2>/dev/null

## warnings
warns="-Xlint:all,-serial"

## standard parameters
params="-s src -d bin"
if [[ $paramBuildScripts = 1 ]]; then
## build scripts
for prog in $(java -jar util-say.jar --list); do
echo "java -jar /usr/bin/util-say.jar $prog \$@" > ./$prog
chmod 755 $prog
done
else
## completion
. run.sh --completion--

## compile util-say
javac $warn -cp . $params $(find src | grep '.java$') 2>&1
## create directory for Java binaries
mkdir bin 2>/dev/null

## warnings
warns="-Xlint:all,-serial"

## standard parameters
params="-s src -d bin"

## compile util-say
javac $warn -cp . $params $(find src | grep '.java$') 2>&1
fi
11 changes: 11 additions & 0 deletions share/bash-completion/completions/util-say
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

_util-say()
{
local cur prev words cword
_init_completion -n = 2>/dev/null

COMPREPLY=( $( compgen -W `util-say --list` -- "$cur" ) )
}

complete -o default -F _util-say util-say
1 change: 1 addition & 0 deletions util-say
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -jar $0.jar $@

0 comments on commit b98f1ee

Please sign in to comment.