Skip to content

Commit

Permalink
refactor(cpu_info): cmd usage info is a bash function
Browse files Browse the repository at this point in the history
  • Loading branch information
kral2 committed Sep 8, 2021
1 parent 9aa44cd commit 1485a19
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ Given a version number MAJOR.MINOR.PATCH:
- MINOR version when adding functionality in a backwards compatible manner,
- PATCH version when making backwards compatible bug fixes.

## [0.5.0] - 2021-09-03
## [0.5.1] - 2021-09-08

## Changed

- cpu_info.sh: use bash function for command usage information

## [0.5.0] - 2021-09-08

## Added

Expand Down
14 changes: 8 additions & 6 deletions system-config/cpu_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
# Also : https://apple.stackexchange.com/questions/238777/how-do-i-identify-which-cpu-a-macbook-uses/238789#238789
# Interesting output with `system_profiler SPHardwareDataType | grep Processor`

usage () {
echo "Usage information: ./cpu_info.sh [--short | --all | --help]"
echo "- short: print CPU Brand/Model, Core count, Thread count"
echo "- all: print all cpu information"
}

if [ -z "$1" ]; then
sysctl -n machdep.cpu.brand_string
sysctl -a | grep machdep.cpu.core_count | sed 's/machdep.//'
Expand All @@ -17,11 +23,7 @@ elif [ "$1" = "--short" ]; then
sysctl -a | grep machdep.cpu.core_count | sed 's/machdep.//'
sysctl -a | grep machdep.cpu.thread_count | sed 's/machdep.//'
elif [ "$1" = "--help" ]; then
echo "Usage information: ./cpu_info.sh [short|all]"
echo "- short: print CPU Brand/Model, Core count, Thread count"
echo "- all: print all cpu information"
usage
else
echo "Usage information: ./cpu_info.sh [short|all]"
echo "- short: print CPU Brand/Model, Core count, Thread count"
echo "- all: print all cpu information"
usage
fi

0 comments on commit 1485a19

Please sign in to comment.