Merge pull request 'CLI: Added grouping output for clan history list.' (#774) from Qubasa-main into main
This commit is contained in:
@@ -1,12 +1,24 @@
|
|||||||
# !/usr/bin/env python3
|
# !/usr/bin/env python3
|
||||||
import argparse
|
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:
|
def list_history_command(args: argparse.Namespace) -> None:
|
||||||
|
res: dict[str, list[HistoryEntry]] = {}
|
||||||
for history_entry in list_history():
|
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
|
# takes a (sub)parser and configures it
|
||||||
|
|||||||
Reference in New Issue
Block a user