dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit b2450cb5b6144a163afa560e521944580710089f
parent 6b1b487b16148bba4080032b6d482669c25d9a92
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Fri, 12 Jun 2020 16:05:01 +0200

Remove long options, remove version info, small improvements

Diffstat:
M.local/bin/compile | 36++++++++++--------------------------
1 file changed, 10 insertions(+), 26 deletions(-)

diff --git a/.local/bin/compile b/.local/bin/compile @@ -1,27 +1,16 @@ #!/bin/sh set -e -version=0.1 - show_help() { echo "usage: ${0##*/} [OPTIONS] FILE ..." echo "will compile each FILE based on its extension." echo echo "OPTIONS are one or more of the following:" - echo " -h, --help show this message" - echo " -v, --version show version and license information" - echo " -V, --verbose show verbose information" - echo " -c, --continuous continuously recompile upon file changes" - echo " -o, --open open output after compiling, only supported for" - echo " some file types" - echo " -- do not consider any following args as options" -} - -show_version() { - echo "${0##*/} version $version" - echo "Licensed under the ISC License" - echo "written by Anders Damsgaard, anders@adamsgaard.dk" - echo "https://src.adamsgaard.dk/dotfiles" + echo " -h show this message" + echo " -v show verbose information" + echo " -c continuously recompile upon file changes" + echo " -o open output after compiling, only supported for some file types" + echo " -- do not consider any following args as options" } die() { @@ -64,7 +53,6 @@ handle_target() { (>2 printf "File type %s not supported\n" $extension) exit 1;; esac - return 0 else die "cannot open $1" fi @@ -75,21 +63,17 @@ continuous=0 open=0 while :; do case "$1" in - -h|-\?|--help) + -h|-\?) show_help exit 0 ;; - -v|--version) - show_version - exit 0 - ;; - -V|--verbose) + -v) verbose=1 ;; - -c|--continuous) + -c) continuous=1 ;; - -o|--open) + -o) open=1 ;; --) # end all options @@ -107,7 +91,7 @@ done if [ $# -lt 1 ]; then show_help - return 1 + exit 1 else for f in "$@"; do handle_target "$f"