oaknut-cli 12.18.2__tar.gz → 12.19.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.4
2
2
  Name: oaknut-cli
3
- Version: 12.18.2
3
+ Version: 12.19.0
4
4
  Summary: Shared CLI toolkit for the oaknut family: the contributed-command axis and report-rendering helpers a disc command needs, below the filesystem packages.
5
5
  Author-email: Robert Smallshire <robert@smallshire.org.uk>
6
6
  License-Expression: MIT
@@ -40,7 +40,7 @@ from oaknut.cli.reports import (
40
40
  text_cell,
41
41
  )
42
42
 
43
- __version__ = "12.18.2"
43
+ __version__ = "12.19.0"
44
44
 
45
45
  __all__ = [
46
46
  "COMMAND_KIND",
@@ -74,7 +74,9 @@ def bytes_cell(num_bytes: int) -> ByAudience:
74
74
  return ByAudience(machine=num_bytes, human=format_capacity(num_bytes))
75
75
 
76
76
 
77
- def address_cell(address: int, *, conceal: bool = False, min_digits: int = 6) -> ByAudience:
77
+ def address_cell(
78
+ address: int, *, conceal: bool = False, min_digits: int = 6, max_digits: int | None = None
79
+ ) -> ByAudience:
78
80
  """An Acorn load/exec address as an audience-aware cell.
79
81
 
80
82
  Humans read the ``0x``-prefixed hex form, padded to a whole number
@@ -87,6 +89,11 @@ def address_cell(address: int, *, conceal: bool = False, min_digits: int = 6) ->
87
89
  RISC OS ``*Info``. Machine formatters (JSON, TSV) get the raw
88
90
  integer, so a consumer never has to parse a base back out of a string.
89
91
 
92
+ With *max_digits* the human form shows only the low *max_digits* hex
93
+ digits. DFS passes six: its OSFILE value for an I/O-processor address
94
+ is ``&FFFF1900``, but ``*EX`` / ``*INFO`` print the low three bytes,
95
+ ``FF1900``. The machine form always keeps the whole value.
96
+
90
97
  When *conceal* is set the human form is blank but the machine form
91
98
  keeps the raw integer: a filetype-stamped file's load/exec hold an
92
99
  encoded filetype and datestamp shown in their own columns, yet a
@@ -94,9 +101,10 @@ def address_cell(address: int, *, conceal: bool = False, min_digits: int = 6) ->
94
101
  """
95
102
  if conceal:
96
103
  return ByAudience(machine=address, human="")
97
- digits = max(min_digits, len(f"{address:X}"))
104
+ shown = address if max_digits is None else address & ((1 << (4 * max_digits)) - 1)
105
+ digits = max(min_digits, len(f"{shown:X}"))
98
106
  width = digits + (digits & 1) # round up to a whole number of bytes
99
- return ByAudience(machine=address, human=f"0x{address:0{width}X}")
107
+ return ByAudience(machine=address, human=f"0x{shown:0{width}X}")
100
108
 
101
109
 
102
110
  def filetype_cell(filetype: int) -> ByAudience:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oaknut-cli
3
- Version: 12.18.2
3
+ Version: 12.19.0
4
4
  Summary: Shared CLI toolkit for the oaknut family: the contributed-command axis and report-rendering helpers a disc command needs, below the filesystem packages.
5
5
  Author-email: Robert Smallshire <robert@smallshire.org.uk>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes