Update
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
* Espifetch
|
||||||
|
Espifetch is a basic fetch application with radqueer pride flags.
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
current_dir=$(pwd)
|
import distro
|
||||||
|
from logo_scripts import debian
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
cd /opt/espifetch && uv run main.py
|
if distro.id() == "debian":
|
||||||
|
debian.print_debian(Path(__file__).parent)
|
||||||
cd $current_dir
|
else:
|
||||||
|
print("Distro not supported.")
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
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)
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
from colored import Fore, Back, Style
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
python_script_path = Path(__file__).parent
|
|
||||||
|
|
||||||
|
|
||||||
def set_logo(distro="linux"):
|
|
||||||
distro_logo_path = None
|
|
||||||
color = None
|
|
||||||
match distro:
|
|
||||||
case "debian":
|
|
||||||
distro_logo_path = python_script_path / "logos" / "debian.txt"
|
|
||||||
color = Fore.red
|
|
||||||
case _:
|
|
||||||
distro_logo_path = python_script_path / "logos" / "linux.txt"
|
|
||||||
|
|
||||||
return distro_logo_path, color
|
|
||||||
|
|
||||||
|
|
||||||
def open_logo_file(path):
|
|
||||||
with open(path, "r") as f:
|
|
||||||
return f.read()
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
from colored import Fore, Style
|
||||||
|
import cpuinfo
|
||||||
|
import distro
|
||||||
|
import getpass
|
||||||
|
import os
|
||||||
|
import socket
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
logo_color = Fore.red
|
||||||
|
color1 = Fore.red
|
||||||
|
color2 = Fore.green
|
||||||
|
color3 = Fore.yellow
|
||||||
|
color4 = Fore.blue
|
||||||
|
color5 = Fore.magenta
|
||||||
|
|
||||||
|
def print_debian(main_dir):
|
||||||
|
current_line = 1
|
||||||
|
logo = open(main_dir / "logos" / "debian.txt", "r").read().split("\n")
|
||||||
|
for line in logo:
|
||||||
|
colored_line = str(logo_color) + 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 + " " + 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)
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import distro
|
|
||||||
from info import print_info
|
|
||||||
from logo import set_logo, open_logo_file
|
|
||||||
|
|
||||||
distro_id = distro.id()
|
|
||||||
logo, color = set_logo(distro_id)
|
|
||||||
|
|
||||||
print_info(open_logo_file(logo), color)
|
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
name = "espifetch"
|
name = "espifetch"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Espifetch is a basic fetch application with radqueer pride flags."
|
description = "Espifetch is a basic fetch application with radqueer pride flags."
|
||||||
readme = "README.md"
|
readme = "README.org"
|
||||||
requires-python = ">=3.14"
|
requires-python = ">=3.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"colored>=2.3.1",
|
"colored>=2.3.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user