Skip to content

Commit 1485a19

Browse files
committed
refactor(cpu_info): cmd usage info is a bash function
1 parent 9aa44cd commit 1485a19

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ Given a version number MAJOR.MINOR.PATCH:
1414
- MINOR version when adding functionality in a backwards compatible manner,
1515
- PATCH version when making backwards compatible bug fixes.
1616

17-
## [0.5.0] - 2021-09-03
17+
## [0.5.1] - 2021-09-08
18+
19+
## Changed
20+
21+
- cpu_info.sh: use bash function for command usage information
22+
23+
## [0.5.0] - 2021-09-08
1824

1925
## Added
2026

system-config/cpu_info.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
# Also : https://apple.stackexchange.com/questions/238777/how-do-i-identify-which-cpu-a-macbook-uses/238789#238789
77
# Interesting output with `system_profiler SPHardwareDataType | grep Processor`
88

9+
usage () {
10+
echo "Usage information: ./cpu_info.sh [--short | --all | --help]"
11+
echo "- short: print CPU Brand/Model, Core count, Thread count"
12+
echo "- all: print all cpu information"
13+
}
14+
915
if [ -z "$1" ]; then
1016
sysctl -n machdep.cpu.brand_string
1117
sysctl -a | grep machdep.cpu.core_count | sed 's/machdep.//'
@@ -17,11 +23,7 @@ elif [ "$1" = "--short" ]; then
1723
sysctl -a | grep machdep.cpu.core_count | sed 's/machdep.//'
1824
sysctl -a | grep machdep.cpu.thread_count | sed 's/machdep.//'
1925
elif [ "$1" = "--help" ]; then
20-
echo "Usage information: ./cpu_info.sh [short|all]"
21-
echo "- short: print CPU Brand/Model, Core count, Thread count"
22-
echo "- all: print all cpu information"
26+
usage
2327
else
24-
echo "Usage information: ./cpu_info.sh [short|all]"
25-
echo "- short: print CPU Brand/Model, Core count, Thread count"
26-
echo "- all: print all cpu information"
28+
usage
2729
fi

0 commit comments

Comments
 (0)