delayed-rm 2.9.3__tar.gz → 2.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: delayed_rm
3
- Version: 2.9.3
3
+ Version: 2.10.0
4
4
  Summary: Ever wish you had a few minutes to undo an rm? Now you do!
5
5
  License: GPLv3
6
6
  Project-URL: Homepage, https://github.com/zwimer/delayed_rm
@@ -8,11 +8,12 @@ import subprocess
8
8
  import argparse
9
9
  import tempfile
10
10
  import shutil
11
+ import math
11
12
  import time
12
13
  import sys
13
14
 
14
15
 
15
- __version__ = "2.9.3"
16
+ __version__ = "2.10.0"
16
17
 
17
18
 
18
19
  #
@@ -51,6 +52,16 @@ class _Secret:
51
52
  #
52
53
 
53
54
 
55
+ def _size(p: Path) -> str:
56
+ """
57
+ Get file size as a human readable string
58
+ """
59
+ s = p.stat().st_size
60
+ lg = int(math.log(s, 1000))
61
+ si = " KMGT"[lg].replace(" ", "")
62
+ return f"{round(s/(1000**lg))} {si}B"
63
+
64
+
54
65
  def _eprint(e: str | BaseException) -> None:
55
66
  """
56
67
  Print e to stderr
@@ -213,7 +224,7 @@ def delayed_rm_raw(delay: int, log: bool, r: bool, f: bool, paths: list[Path]) -
213
224
  if r or f or paths:
214
225
  _eprint("--log may not be used with other arguments")
215
226
  return False
216
- print(f"{log_f.read_text()}Log file: {log_f}" if log_f.exists() else "Log is empty")
227
+ print(f"{log_f.read_text()}Log file ({_size(log_f)}): {log_f}" if log_f.exists() else "Log is empty")
217
228
  return True
218
229
  if not paths:
219
230
  _eprint("nothing to remove")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: delayed_rm
3
- Version: 2.9.3
3
+ Version: 2.10.0
4
4
  Summary: Ever wish you had a few minutes to undo an rm? Now you do!
5
5
  License: GPLv3
6
6
  Project-URL: Homepage, https://github.com/zwimer/delayed_rm
File without changes
File without changes
File without changes
File without changes