Skip to content

Commit 74e32fa

Browse files
committed
Update help menu
1 parent cbb3e24 commit 74e32fa

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

main.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func setupUI() {
107107
appleSiliconModel := getSOCInfo()
108108
modelText, helpText = w.NewParagraph(), w.NewParagraph()
109109
modelText.Title = "Apple Silicon"
110-
helpText.Title = "Help Menu"
110+
helpText.Title = "mactop help menu"
111111
modelName, ok := appleSiliconModel["name"].(string)
112112
if !ok {
113113
modelName = "Unknown Model"
@@ -131,7 +131,7 @@ func setupUI() {
131131
pCoreCount,
132132
gpuCoreCount,
133133
)
134-
helpText.Text = "- r: Refresh the UI data manually\n- l: Toggle the main display's layout\n- h: Toggle this help menu\n- ?: Toggle this help menu\n- q: Quit the application\n- <C-c>: Quit the application"
134+
helpText.Text = "mactop is open source monitoring tool for Apple Silicon authored by Carsen Klock in Go Lang!\n\nRepo: github.com/context-labs/mactop\n\nControls:\n- r: Refresh the UI data manually\n- l: Toggle the main display's layout\n- h or ?: Toggle this help menu\n- q or <C-c>: Quit the application\n\nStart Flags:\n--help, -h: Show this help menu\n--version, -v: Show the version of mactop\n--interval, -i: Set the powermetrics update interval in milliseconds. Default is 1000.\n--color, -c: Set the UI color. Default is none. Options are 'green', 'red', 'blue', 'cyan', 'magenta', 'yellow', and 'white'."
135135
stderrLogger.Printf("Model: %s\nE-Core Count: %d\nP-Core Count: %d\nGPU Core Count: %s",
136136
modelName,
137137
eCoreCount,
@@ -243,8 +243,8 @@ func toggleHelpMenu() {
243243
),
244244
)
245245
termWidth, termHeight := ui.TerminalDimensions()
246-
helpTextGridWidth := termWidth / 3
247-
helpTextGridHeight := termHeight / 2
246+
helpTextGridWidth := termWidth
247+
helpTextGridHeight := termHeight
248248
x := (termWidth - helpTextGridWidth) / 2
249249
y := (termHeight - helpTextGridHeight) / 2
250250
newGrid.SetRect(x, y, x+helpTextGridWidth, y+helpTextGridHeight)
@@ -256,6 +256,8 @@ func toggleHelpMenu() {
256256
}[currentGridLayout == "default"]
257257
switchGridLayout()
258258
}
259+
ui.Clear()
260+
ui.Render(grid)
259261
}
260262

261263
func StderrToLogfile(logfile *os.File) {
@@ -269,17 +271,11 @@ func main() {
269271
err error
270272
setColor, setInterval bool
271273
)
272-
version := "v0.1.8"
274+
version := "v0.1.9"
273275
for i := 1; i < len(os.Args); i++ {
274276
switch os.Args[i] {
275277
case "--help", "-h":
276-
fmt.Println("Usage: mactop [--help] [--version] [--interval] [--color]")
277-
fmt.Println("--help: Show this help message")
278-
fmt.Println("--version: Show the version of mactop")
279-
fmt.Println("--interval: Set the powermetrics update interval in milliseconds. Default is 1000.")
280-
fmt.Println("--color: Set the UI color. Default is white. Options are 'green', 'red', 'blue', 'cyan', 'magenta', 'yellow', and 'white'. (-c green)")
281-
fmt.Println("You must use sudo to run mactop, as powermetrics requires root privileges.")
282-
fmt.Println("For more information, see https://github.com/context-labs/mactop")
278+
fmt.Print("Usage: mactop [--help] [--version] [--interval] [--color]\n--help: Show this help message\n--version: Show the version of mactop\n--interval: Set the powermetrics update interval in milliseconds. Default is 1000.\n--color: Set the UI color. Default is none. Options are 'green', 'red', 'blue', 'cyan', 'magenta', 'yellow', and 'white'. (-c green)\n\nYou must use sudo to run mactop, as powermetrics requires root privileges.\n\nFor more information, see https://github.com/context-labs/mactop written by Carsen Klock.\n")
283279
os.Exit(0)
284280
case "--version", "-v":
285281
fmt.Println("mactop version:", version)

0 commit comments

Comments
 (0)