keirf / greaseweazle

Tools for accessing a floppy drive at the raw flux level
The Unlicense
997 stars 100 forks source link

Output of Extensions #323

Closed Akutra closed 1 year ago

Akutra commented 1 year ago

Would it be possible to add acceptable extensions output to the help documentation? Optionally, you could add a separate command to output available gw formats and/or file types.

Example for read.py

def main(argv):

    epilog = (util.drive_desc + "\n"
              + util.speed_desc + "\n" + util.tspec_desc
              + "\n" + util.pllspec_desc
              + "\nFORMAT options:\n" + formats.print_formats()
              + "\n\nAccepted File Suffixes:\n" + util.print_file_suffix())

Add to util.py

def print_file_suffix():
    return columnify(image_types)

Additionally, Bug in output from PowerShell output cuts off would be fixed by the below change to use columnify:

def get_image_class(name):
    _, ext = os.path.splitext(name)
    error.check(ext.lower() in image_types,
                """\
                %s: Unrecognised file suffix '%s'
                Known suffixes: %s"""
                % (name, ext, columnify(image_types)))