commit ac6b3e900857d0856909712b5a99736c0bf1d28c
parent 49087225708cd48aa5964d94d7900d9a4c56094f
Author: René Wagner <rwa@clttr.info>
Date: Wed, 18 Jan 2023 18:49:38 +0100
fix display of help and version info
Diffstat:
M | astro | | | 39 | +++++++++++++++++++-------------------- |
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/astro b/astro
@@ -1,14 +1,13 @@
#!/bin/sh
usage() {
- echo "Astro v0.16.0: Browse the gemini web on the terminal."
+ echo "Astro v0.18.0: Browse the gemini web on the terminal."
echo ""
echo "Usage: astro [url]|[option]"
echo ""
echo "Options:"
- echo " -h show this help"
- echo " --help show this help"
- echo " --version show version info"
+ echo " -h, --help show this help"
+ echo " -v, --version show version info"
echo ""
echo "Commands available inside the browser:"
echo " q quit"
@@ -32,11 +31,12 @@ usage() {
echo "Report bugs to: bleemayer@gmail.com"
echo "Home page: <https://www.github.com/blmayer/astro/>"
echo "General help: <https://www.github.com/blmayer/astro/wiki>"
+ exit
}
version() {
- echo "astro 0.16.0"
- echo "Copyright (C) 2021 Brian Mayer."
+ echo "astro 0.18.0"
+ echo "Copyright (C) 2021-2023 Brian Mayer."
echo "License MIT: MIT License <https://opensource.org/licenses/MIT>"
echo "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,"
echo "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF"
@@ -49,6 +49,19 @@ debug() {
[ "$debug" ] && echo "DEBUG: $*" >&2 && sleep 2
}
+# Parse arguments
+args="$*"
+case "$args" in
+ '--help'* | '-h'*)
+ usage
+ exit
+ ;;
+ '--version'* | '-v'*)
+ version
+ exit
+ ;;
+esac
+
# Save terminal
tput smcup
@@ -391,20 +404,6 @@ EOF
# Execution
export LESS='-P Keys\: qgrbosHmM, to see a description run astro -h'
-# Parse arguments
-args="$*"
-case "$args" in
- '--help'* | '-h'*)
- usage
- exit
- ;;
- '--version'*)
- version
- exit
- ;;
-esac
-
-
# First request
url="${args:-$homepage}"