Skip to content

Commit

Permalink
-V, --version options
Browse files Browse the repository at this point in the history
  • Loading branch information
slowpeek committed Oct 15, 2022
1 parent c79b0c8 commit b43861d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
+ =hddtemp= :: Show temps for all =sd= and =nvme= disks.
+ =hddtemp /dev/sda ...= :: Show temps for selected disks

Options:

- =-h, --help= :: Show usage
- =-V, --version= :: Show version

* Requirements

- =smartctl= (=smartmontools= package)
Expand Down
21 changes: 18 additions & 3 deletions hddtemp
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,49 @@ shopt -s nullglob
# A very basic replacement for hddtemp tool missing from Ubuntu
# 22.04. It requires smartctl (smartmontools package).

SCRIPT_VERSION=0.1

bye() {
echo "$@" >&2
exit 1
}

version() {
echo "$SCRIPT_VERSION"
exit
}

usage() {
local self=${BASH_SOURCE[0]##*/}

cat <<EOF
Usage --
USAGE --
${self}
show temps for all sd and nvme disks
${self} /dev/sda ...
show temps for selected disks
Options:
-h, --help Show usage
-V, --version Show version
Homepage https://github.com/slowpeek/hddtemp
EOF
exit 0

exit
}

opts=$(getopt -o h -l help -- "$@") || exit
opts=$(getopt -o hV -l help,version -- "$@") || exit
eval set -- "$opts"

while (( $# )); do
case $1 in
-h|--help)
usage ;;
-V|--version)
version ;;
--)
shift
break ;;
Expand Down

0 comments on commit b43861d

Please sign in to comment.