init
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
# Python-generated files
|
||||
__pycache__/
|
||||
*.py[oc]
|
||||
build/
|
||||
dist/
|
||||
wheels/
|
||||
*.egg-info
|
||||
|
||||
# Virtual environments
|
||||
.venv
|
||||
@@ -0,0 +1 @@
|
||||
3.14
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
current_dir=$(pwd)
|
||||
|
||||
cd /opt/espifetch && uv run main.py
|
||||
|
||||
cd $current_dir
|
||||
@@ -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)
|
||||
@@ -0,0 +1,22 @@
|
||||
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,6 @@
|
||||
_____
|
||||
/ __ \
|
||||
| / |
|
||||
| \___-
|
||||
-_
|
||||
--_
|
||||
@@ -0,0 +1,8 @@
|
||||
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)
|
||||
@@ -0,0 +1,11 @@
|
||||
[project]
|
||||
name = "espifetch"
|
||||
version = "0.1.0"
|
||||
description = "Espifetch is a basic fetch application with radqueer pride flags."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"colored>=2.3.1",
|
||||
"distro>=1.9.0",
|
||||
"py-cpuinfo>=9.0.0",
|
||||
]
|
||||
@@ -0,0 +1,47 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
requires-python = ">=3.14"
|
||||
|
||||
[[package]]
|
||||
name = "colored"
|
||||
version = "2.3.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/4a/32/b772def12071faf780dd14e8a95ec8eba4bf5934f302de3a3780b919859a/colored-2.3.1.tar.gz", hash = "sha256:fe6e888e12dc16643daa0b108f785df6d0b48420084b5d0a567de27bb09a14d8", size = 16046, upload-time = "2025-07-31T08:40:05.38Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e4/33/58702880fe6bb3ed91cb21e1c92b002f9b73e32c0c5e3e9e2c0a94eaac61/colored-2.3.1-py3-none-any.whl", hash = "sha256:15d85396d6841f79534bf4668330b5e8686a5e58e730c84ada0e09d335b21fd1", size = 19925, upload-time = "2025-07-31T08:40:03.859Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "distro"
|
||||
version = "1.9.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fc/f8/98eea607f65de6527f8a2e8885fc8015d3e6f5775df186e443e0964a11c3/distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed", size = 60722, upload-time = "2023-12-24T09:54:32.31Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277, upload-time = "2023-12-24T09:54:30.421Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "espifetch"
|
||||
version = "0.1.0"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "colored" },
|
||||
{ name = "distro" },
|
||||
{ name = "py-cpuinfo" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "colored", specifier = ">=2.3.1" },
|
||||
{ name = "distro", specifier = ">=1.9.0" },
|
||||
{ name = "py-cpuinfo", specifier = ">=9.0.0" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "py-cpuinfo"
|
||||
version = "9.0.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/37/a8/d832f7293ebb21690860d2e01d8115e5ff6f2ae8bbdc953f0eb0fa4bd2c7/py-cpuinfo-9.0.0.tar.gz", hash = "sha256:3cdbbf3fac90dc6f118bfd64384f309edeadd902d7c8fb17f02ffa1fc3f49690", size = 104716, upload-time = "2022-10-25T20:38:06.303Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e0/a9/023730ba63db1e494a271cb018dcd361bd2c917ba7004c3e49d5daf795a2/py_cpuinfo-9.0.0-py3-none-any.whl", hash = "sha256:859625bc251f64e21f077d099d4162689c762b5d6a4c3c97553d56241c9674d5", size = 22335, upload-time = "2022-10-25T20:38:27.636Z" },
|
||||
]
|
||||
Reference in New Issue
Block a user