diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.sh | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/src/main.sh b/src/main.sh index 35156b3..c62262e 100644 --- a/src/main.sh +++ b/src/main.sh @@ -15,8 +15,63 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +usage() +{ + printf 'Usage: %s [option ...]\n' "${0}" +} + +help() +{ + usage + cat <<EOF +Options: + -h Display this information + -V Display version information + -i {cli|tui} Select either a textual user interface or a command line + interface (default: cli) +EOF +} + +version() +{ + cat <<EOF +firman ${PACKAGE_VERSION} +Copyright (C) 2015 Patrick "P. J." McDermott +License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +EOF +} + main() { - init_ui 'cli' + local opt= + local ui='cli' + + unset OPTARG + while getopts 'hVi:' opt; do + case "${opt}" in + 'h') + help + exit + ;; + 'V') + version + exit + ;; + 'i') + ui="${OPTARG}" + ;; + esac + unset OPTARG + done + shift $(($OPTIND - 1)) + + if [ ${#} -ne 0 ]; then + usage >&2 + exit 1 + fi + + init_ui "${ui}" info 'Hello, world!' } |