blob: 3e5de4751fd901707070441707f335a08f2537f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
diff --git a/bpytop.py b/bpytop.py
index a1c2b3a..b1cc28e 100755
--- a/bpytop.py
+++ b/bpytop.py
@@ -64,23 +64,27 @@ args.add_argument("-p" , "--proc" ,action="store_true" ,help ="Start in minimal
args.add_argument("-s" , "--stat" ,action="store_true" ,help ="Start in minimal mode without process box")
args.add_argument("-v" , "--version" ,action="store_true" ,help ="Show version info and exit")
args.add_argument("--debug" ,action="store_true" ,help ="Start with loglevel set to DEBUG overriding value set in config")
-stdargs = args.parse_args()
-
-if stdargs.version:
- print(f'bpytop version: {VERSION}\n'
- f'psutil version: {".".join(str(x) for x in psutil.version_info)}')
- raise SystemExit(0)
ARG_MODE: str = ""
-if stdargs.full:
- ARG_MODE = "full"
-elif stdargs.proc:
- ARG_MODE = "proc"
-elif stdargs.stat:
- ARG_MODE = "stat"
+if __name__ == "__main__":
+ stdargs = args.parse_args()
+
+ if stdargs.version:
+ print(f'bpytop version: {VERSION}\n'
+ f'psutil version: {".".join(str(x) for x in psutil.version_info)}')
+ raise SystemExit(0)
-DEBUG = stdargs.debug
+ if stdargs.full:
+ ARG_MODE = "full"
+ elif stdargs.proc:
+ ARG_MODE = "proc"
+ elif stdargs.stat:
+ ARG_MODE = "stat"
+
+ DEBUG = stdargs.debug
+else:
+ DEBUG = False
#? Variables ------------------------------------------------------------------------------------->
|