summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.sh36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/main.sh b/src/main.sh
index c4b7491..42e4d96 100644
--- a/src/main.sh
+++ b/src/main.sh
@@ -19,19 +19,23 @@ set -u
usage()
{
- printf 'Usage: %s [option ...]\n' "${0}"
+ printf 'Usage: %s [option ...] <action>\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)
-o <file> Log output to <file>
+
+Actions:
+ update Update firmware
EOF
}
@@ -50,6 +54,7 @@ main()
{
local opt=
local ui='cli'
+ local action=
unset OPTARG
while getopts 'hVi:o:' opt; do
@@ -73,10 +78,18 @@ main()
done
shift $(($OPTIND - 1))
- if [ ${#} -ne 0 ]; then
+ if [ ${#} -ne 1 ]; then
usage >&2
exit 1
fi
+ action="${1}"
+
+ case "${action}" in
+ 'update');;
+ *)
+ usage >&2
+ exit 1
+ esac
if ! init_ui "${ui}"; then
exit 1
@@ -84,18 +97,13 @@ main()
srand $(expr ${$} + $(date '+%s'))
init_temp_dir
- while :; do
- case "$(show_menu 'Firmware Manager' 'Update firmware' \
- 'Exit')" in
- 0)
- do_update
- ;;
- 1)
- info 'Exiting'
- break
- ;;
- esac
- done
+ case "${action}" in
+ 'update')
+ do_update
+ ;;
+ esac
+
+ info 'Exiting'
fini_temp_dir
exit_ui