Skip to content

Commit 447a806

Browse files
use @main entrypoint
1 parent 972bf61 commit 447a806

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/TerminalSystemMonitor.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ using Dates: Dates, Day, DateTime, Second
44
using UnicodePlots
55
import Term # this is required by UnicodePlots.panel
66

7+
export main
8+
79
idle_time(info::Sys.CPUinfo) = Int64(info.cpu_times!idle)
810

911
busy_time(info::Sys.CPUinfo) = Int64(
@@ -108,7 +110,7 @@ function layout(x, y)
108110
return foldl(/, map(c -> prod(UnicodePlots.panel.(c)), chunks))
109111
end
110112

111-
function main()
113+
function main(dummyargs...)
112114
hidecursor()
113115

114116
while true
@@ -140,4 +142,6 @@ function main()
140142
unhidecursor() # unhide cursor
141143
end
142144

145+
@isdefined(var"@main") ? (@main) : exit(main(ARGS))
146+
143147
end # module TerminalSystemMonitor

0 commit comments

Comments
 (0)