Compare commits
No commits in common. "a17b8e0ef53a7a68560f0379c4b25b04c050325a" and "fdc58d1328d0ecf8683c56d742d679a2d1c97252" have entirely different histories.
a17b8e0ef5
...
fdc58d1328
2 changed files with 2 additions and 65 deletions
|
@ -1,63 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
from typing import List
|
||||
|
||||
|
||||
class Exe:
|
||||
def __init__(self, owner: str, name: str, exe: str | None = None) -> None:
|
||||
self.owner = owner
|
||||
self.name = name
|
||||
self.exe = name if exe is None else exe
|
||||
self.repo = f"{owner}/{name}"
|
||||
|
||||
def fetch_tags(self) -> List[str]:
|
||||
output = subprocess.check_output(
|
||||
[
|
||||
"gh",
|
||||
"api",
|
||||
"-H",
|
||||
"Accept: application/vnd.github+json",
|
||||
"-H",
|
||||
"X-GitHub-Api-Version: 2022-11-28",
|
||||
"--paginate",
|
||||
f"repos/{self.owner}/{self.name}/tags",
|
||||
],
|
||||
text=True,
|
||||
)
|
||||
if self.name == "ripgrep":
|
||||
tags = [n for o in json.loads(output) if (n := o["name"])[0].isdigit()]
|
||||
else:
|
||||
tags = [n for o in json.loads(output) if (n := o["name"]).startswith("v")]
|
||||
if not tags:
|
||||
print(f"recieved no tags for {self.owner}/{self.name}")
|
||||
return tags
|
||||
|
||||
def current_version(self) -> str:
|
||||
return subprocess.check_output([self.exe, "--version"], text=True)
|
||||
|
||||
def display(self) -> None:
|
||||
print(f"""
|
||||
name: {self.owner}/{self.name}
|
||||
latest: {self.fetch_tags()[0]}
|
||||
current:
|
||||
""")
|
||||
|
||||
print("\n".join([f" | {line} " for line in self.current_version().splitlines()]))
|
||||
|
||||
|
||||
EXECUTABLES = [
|
||||
Exe(*args)
|
||||
for args in (
|
||||
("sharkdp", "fd"),
|
||||
("BurntSushi", "ripgrep", "rg"),
|
||||
("cli", "cli", "gh"),
|
||||
("jesseduffield", "lazygit"),
|
||||
("neovim", "neovim", "nvim"),
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
for exe in EXECUTABLES:
|
||||
exe.display()
|
|
@ -23,7 +23,7 @@ background {
|
|||
# TIME
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:1000] echo "$(date +"%R")"
|
||||
text = cmd[update:30000] echo "$(date +"%R")"
|
||||
color = $text
|
||||
font_size = 90
|
||||
font_family = $font
|
||||
|
@ -35,7 +35,7 @@ label {
|
|||
# DATE
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:6000] echo "$(date +"%A, %d %B %Y")"
|
||||
text = cmd[update:43200000] echo "$(date +"%A, %d %B %Y")"
|
||||
color = $text
|
||||
font_size = 25
|
||||
font_family = $font
|
||||
|
|
Loading…
Reference in a new issue