CiderPress2 icon indicating copy to clipboard operation
CiderPress2 copied to clipboard

Add disk-info command

Open fadden opened this issue 2 months ago • 0 comments

It would be useful to have a CLI command that dumps disk information, such as the volume name and disk geometry (such as tracks/sectors for 5.25" disks). Currently, the closest thing to this is the header on catalog/mdc output, e.g.:

Disk image (Unadorned, order=dos/sect) - 140KB DOS 3.3 Vol 254, 4 sectors free
Disk image (Unadorned, order=pdos/blk) - 140KB ProDOS "KSYNTHED140", 25 blocks free
Disk image (Unadorned) - 800KB Pascal "MONSTER", 965 blocks free
Disk image (Nibble525, codec=Std 16-sector) - 140KB DOS 3.3 Vol 254, 247 sectors free
Disk image (Nibble525, codec=Std 13-sector) - 114KB DOS 3.2 Vol 254, 401 sectors free
Disk image (2IMG, order=dos/sect) - 140KB DOS 3.3 Vol 254, 15 sectors free
Disk image (WOZ, codec=Muse 13-sector) - 114KB DOS 3.2 Vol 001, 223 sectors free
Disk image (2IMG) - 800KB ProDOS "ProLine.1", 103 blocks free

Commit e60bc1f added get-attr filename, which allowed retrieval of the volume name, but this feels like a bit of a hack.

The idea would be to have a new disk-info command available to the CLI that would report:

  • disk image type, e.g. WOZ or 2IMG (probably redundant with filename extension, unless it's gzipped)
  • (5.25" disks only):
    • number of tracks
    • number of sectors
    • sector "codec" (13-sector, 16-sector, MUSE, etc.)
    • DOS vs. ProDOS order
  • (block images and 16-sector 5.25" disks): total number of blocks
  • filesystem format
  • (CP/M volumes): block size
  • volume name or (for DOS) VTOC volume number
  • (?) free space available
  • high-quality checksum (e.g. SHA-1), to identify duplicate disk images

This would be for disk images only. Attempting to use it on a file archive would cause an error.

The output could work the same as get-attr, which outputs a human-readable dump in the default case, but a machine-readable value if you request a single attribute. The problem with this approach is that cp2 has a nonzero startup time, so issuing multiple requests can be sluggish. For automation, either the calling script needs to parse the human-readable output, or we need to have a way to request a machine-readable blob.

fadden avatar Oct 05 '25 22:10 fadden