diff --git a/Makefile b/Makefile index 2569307..b98ce8e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ install: all $(libdir)/shsub \ $(mandir)/man1 $(INSTALL) cli tc $(libdir)/shsub/ - $(INSTALL) -m644 usage version LICENSE $(libdir)/shsub/ + $(INSTALL) -m644 version LICENSE $(libdir)/shsub/ $(INSTALL) -m644 shsub.1 $(mandir)/man1/ @echo generate "`echo $(bindir)/shsub`" @>$(bindir)/shsub diff --git a/cli.sh b/cli.sh index eccac2b..8683807 100644 --- a/cli.sh +++ b/cli.sh @@ -5,11 +5,23 @@ set -e dir=`dirname -- "$0"` -usage="$dir/usage" version="$dir/version" license="$dir/LICENSE" tc="$dir/tc" +help() { +cat <<\. +usage: shsub [] [] + if is omitted, read from stdin. + +options: + -s specify the shell to execute the compiled script, + `/bin/sh' by default + -h print the brief usage + -v print the version information +. +} + # shell escape shesc() { printf %s "$1" | sed "s/'/'\\\\''/g; 1 s/^/'/; $ s/$/'/" @@ -23,13 +35,12 @@ sh=/bin/sh while getopts 's:hv' opt; do case $opt in s) sh="$OPTARG";; - h) cat "$usage"; + h) help exit;; - v) echo shsub "`cat "$version"`"; - cat "$license"; + v) echo shsub "`cat "$version"`" + cat "$license" exit;; - ?) echo type \`shsub -h\' for the brief usage - echo 'read the man page shsub(1) for detail' + ?) help >&2 exit 1;; esac done diff --git a/usage b/usage deleted file mode 100644 index 14cc362..0000000 --- a/usage +++ /dev/null @@ -1,12 +0,0 @@ -shsub - compile the shell template to a shell script and execute it - -usage: shsub [] [] - -if is omitted, read from stdin. - -options: - --s specify the shell to execute the compiled script, - `/bin/sh' by default --h print the brief usage --v print the version information diff --git a/version b/version index f0bb29e..c3f0d2b 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.3.0 +1.4.0-dev