Merge pull request 'CLI: Added grouping output for clan history list.' (#774) from Qubasa-main into main
This commit is contained in:
commit
170c461ba1
@ -1,12 +1,24 @@
|
||||
# !/usr/bin/env python3
|
||||
import argparse
|
||||
from datetime import datetime
|
||||
|
||||
from .add import list_history
|
||||
from .add import HistoryEntry, list_history
|
||||
|
||||
|
||||
def list_history_command(args: argparse.Namespace) -> None:
|
||||
res: dict[str, list[HistoryEntry]] = {}
|
||||
for history_entry in list_history():
|
||||
print(history_entry.flake.flake_url)
|
||||
url = str(history_entry.flake.flake_url)
|
||||
if res.get(url, None) is None:
|
||||
res[url] = []
|
||||
res[url].append(history_entry)
|
||||
|
||||
for flake_url, entries in res.items():
|
||||
print(flake_url)
|
||||
for entry in entries:
|
||||
d = datetime.fromisoformat(entry.last_used)
|
||||
last_used = d.strftime("%d/%m/%Y %H:%M:%S")
|
||||
print(f" {entry.flake.flake_attr} ({last_used})")
|
||||
|
||||
|
||||
# takes a (sub)parser and configures it
|
||||
|
Loading…
Reference in New Issue
Block a user