summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/apt-up22
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/apt-up b/scripts/apt-up
index e380b51..f8e4b77 100755
--- a/scripts/apt-up
+++ b/scripts/apt-up
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
upgrade_options=''
-ARGS=$(getopt -a -o hy --long opts:,help -- "$@")
+args=$(getopt -a -o hy --long opts:,help -- "$@")
+version='v1.1'
update_database() {
echo 'Updating database...'
@@ -14,22 +15,27 @@ upgrade_packages() {
}
help_page() {
+ show_version
echo "Usage:"
- echo "apt-up [-y] [-h] [--opts $upgrade_options]"
+ echo -e "\tapt-up [-h/--help] [-y/--yes] [--opts $upgrade_options]"
echo "Description:"
- echo -e "\t-y automates the upgrade progress."
- echo -e "\t-h diaplays the help page of apt-up."
+ echo -e "\t-h/--help diaplays the help page of apt-up."
+ echo -e "\t-y/--yes automates the upgrade progress."
echo -e '\t--opts transports $upgrade_options to apt.'
exit -1
}
+show_version() {
+ echo -e "apt-up ${version}\n"
+}
+
update() {
update_database
upgrade_packages
exit 0
}
-eval set -- "${ARGS}"
+eval set -- "${args}"
while :; do
case $1 in
@@ -40,14 +46,14 @@ while :; do
-h | --help)
help_page
;;
- *)
- update
- ;;
--opts)
upgrade_options+=$2
update
shift
;;
+ *)
+ update
+ ;;
esac
shift
done