Make Applications a real app manager, and clean up storage without the racket
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -308,11 +308,21 @@ def delete(config: str, number: str) -> None:
|
||||
raise BoundaryError(_refusal(result, "That snapshot could not be removed."))
|
||||
|
||||
|
||||
# The three horizons the page can edit, and the largest number it will accept
|
||||
# for any of them. 999 hourly snapshots is not a retention policy, it is a typo
|
||||
# that fills a drive; the page offers a dropdown and this is its ceiling. The
|
||||
# monthly and yearly limits are left exactly as snapper has them -- nothing here
|
||||
# writes them, so a config with longer horizons keeps them.
|
||||
RETENTION_LIMIT = 50
|
||||
|
||||
|
||||
def set_retention(config: str, hourly: str, daily: str, weekly: str) -> None:
|
||||
values = []
|
||||
for label, value in (("HOURLY", hourly), ("DAILY", daily), ("WEEKLY", weekly)):
|
||||
if not str(value).isdigit() or int(value) > 999:
|
||||
if not str(value).isdigit():
|
||||
raise BoundaryError("Keep counts must be whole numbers.")
|
||||
if int(value) > RETENTION_LIMIT:
|
||||
raise BoundaryError(f"Keep counts go up to {RETENTION_LIMIT}.")
|
||||
values.append(f"TIMELINE_LIMIT_{label}={int(value)}")
|
||||
result = run(["snapper", "-c", require_config(config), "set-config", *values])
|
||||
if result.returncode != 0:
|
||||
|
||||
Reference in New Issue
Block a user