41 lines
1.7 KiB
Python
41 lines
1.7 KiB
Python
from colored import Fore, Style
|
|
import cpuinfo
|
|
import distro
|
|
import getpass
|
|
from logos import linux
|
|
import os
|
|
import socket
|
|
import subprocess
|
|
|
|
|
|
color1 = Fore.red
|
|
color2 = Fore.green
|
|
color3 = Fore.yellow
|
|
color4 = Fore.blue
|
|
color5 = Fore.magenta
|
|
|
|
def print_linux():
|
|
current_line = 1
|
|
logo = linux.logo
|
|
for line in logo:
|
|
colored_line = line + Style.reset
|
|
match current_line:
|
|
case 1:
|
|
colored_line = colored_line + " " + color1 + "User: " + Style.reset + getpass.getuser()
|
|
case 2:
|
|
colored_line = colored_line + " " + color2 + "Hostname: " + Style.reset + socket.gethostname()
|
|
case 3:
|
|
colored_line = colored_line + " " + color3 + "Uptime: " + Style.reset + subprocess.run(['uptime', '-p'], capture_output=True, text=True, check=True).stdout[:-1]
|
|
case 4:
|
|
colored_line = colored_line + " " + color4 + "Distro: " + Style.reset + distro.name(pretty=True)
|
|
case 5:
|
|
colored_line = colored_line + " " + color5 + "Kernel: " + Style.reset + subprocess.run(['uname', '-sr'], capture_output=True, text=True, check=True).stdout[:-1]
|
|
case 6:
|
|
colored_line = colored_line + " " + color1 + "Terminal: " + Style.reset + os.environ["TERM"]
|
|
case 7:
|
|
colored_line = colored_line + " " + str(color2) + "Shell: " + Style.reset + os.environ["SHELL"]
|
|
print(colored_line, '')
|
|
current_line += 1
|
|
colored_line = " " + str(color3) + "CPU: " + Style.reset + cpuinfo.get_cpu_info()["brand_raw"]
|
|
print(colored_line)
|