init
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
from colored import Fore, Style
|
||||
import cpuinfo
|
||||
import distro
|
||||
import getpass
|
||||
import socket
|
||||
import os
|
||||
|
||||
|
||||
def print_info(logo, color):
|
||||
lines = 1
|
||||
for line in logo.split("\n"):
|
||||
current_line = color + line + Style.reset
|
||||
match lines:
|
||||
case 1:
|
||||
current_line = (
|
||||
current_line
|
||||
+ " "
|
||||
+ Fore.red
|
||||
+ "User: "
|
||||
+ Style.reset
|
||||
+ getpass.getuser()
|
||||
)
|
||||
case 2:
|
||||
current_line = (
|
||||
current_line
|
||||
+ " "
|
||||
+ Fore.green
|
||||
+ "Hostname: "
|
||||
+ Style.reset
|
||||
+ socket.gethostname()
|
||||
)
|
||||
case 3:
|
||||
current_line = (
|
||||
current_line
|
||||
+ " "
|
||||
+ Fore.yellow
|
||||
+ "Uptime: "
|
||||
+ Style.reset
|
||||
+ os.popen("uptime -p").read()[:-1]
|
||||
)
|
||||
case 4:
|
||||
current_line = (
|
||||
current_line
|
||||
+ " "
|
||||
+ Fore.blue
|
||||
+ "Distro: "
|
||||
+ Style.reset
|
||||
+ distro.name(pretty=True)
|
||||
)
|
||||
case 5:
|
||||
current_line = (
|
||||
current_line
|
||||
+ " "
|
||||
+ Fore.magenta
|
||||
+ "Kernel: "
|
||||
+ Style.reset
|
||||
+ os.popen("uname -sr").read()[:-1]
|
||||
)
|
||||
case 6:
|
||||
current_line = (
|
||||
current_line
|
||||
+ " "
|
||||
+ Fore.red
|
||||
+ "Terminal: "
|
||||
+ Style.reset
|
||||
+ os.environ["TERM"]
|
||||
)
|
||||
case 7:
|
||||
current_line = (
|
||||
current_line
|
||||
+ " "
|
||||
+ Fore.green
|
||||
+ "Shell: "
|
||||
+ Style.reset
|
||||
+ os.environ["SHELL"]
|
||||
)
|
||||
print(current_line)
|
||||
lines += 1
|
||||
current_line = (
|
||||
" "
|
||||
+ Fore.yellow
|
||||
+ "CPU: "
|
||||
+ Style.reset
|
||||
+ cpuinfo.get_cpu_info()["brand_raw"]
|
||||
)
|
||||
print(current_line)
|
||||
Reference in New Issue
Block a user