-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli_options.py
More file actions
34 lines (28 loc) · 925 Bytes
/
Copy pathcli_options.py
File metadata and controls
34 lines (28 loc) · 925 Bytes
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
# Standerd argparse implementation
import argparse
parser = argparse.ArgumentParser(
description="Hard test ultimate script",
epilog="Just for future needs")
def cpu_usage():
print("CPU Usage.")
def mem_usage():
print("Memory usage")
def disc_usage():
print("Discspace usage")
# We add some argument name (just name)
#parser.add_argument("cat1", help="Adding a two", type=int)
#parser.add_argument("cat2", help="Adding a two", type=int)
parser.add_argument("-c","--cpu", help="Consume all CPU", action="store_true")
parser.add_argument("-m","--memory", help="Consume all memory", action="store_true")
parser.add_argument("-d","--disc", help="Consume all discspace", action="store_true")
args = parser.parse_args()
if args.cpu:
cpu_usage()
elif args.cpu == 1:
print("Hello")
elif args.cpu == 2:
print("Goodbye")
elif args.memory:
mem_usage()
elif args.disc:
disc_usage()