Skip to content

Incorrect line breaks put metavars on a new row all alone, detached from the argument #12

Closed
@michelcrypt4d4mus

Description

@michelcrypt4d4mus

enjoying this library but ran into a situation where regular argparse does line breaks correctly and this does them in a way that makes it hard to understand the options. Here's the output of rich_argparse that's an issue. The example is from for the help text of the pdfalyzer, a PDF analysis tool i just released. (thess are just a snippet to show the issue but the full help text can be viewed in the pdfalyzer README here and the argparse code that creates them can be viewed here if either of those things is helpful).

Take a look at where the PCT_CONFIDENCE and STREAM_DUMP_DIR metavars end up:

FINE TUNING:
  Settings that affect aspects of the analyis and output

  --force-display-threshold            chardet.detect() scores encodings from 0-100 pct but only above this are displayed                                                                              
PCT_CONFIDENCE                                                                                                                                                                                         
  --force-decode-threshold             extremely high (AKA 'above this number') PCT_CONFIDENCE scores from chardet.detect() as to the likelihood some binary data was written with a particular        
PCT_CONFIDENCE                         encoding will cause  the pdfalyzer to do a force decode of that with that encoding. (chardet is a sophisticated libary; this is pdfalyzer's way of harnessing   
                                       that intelligence)                                                                                                                                              
FILE EXPORT:
  Export to various kinds of files
                                                                         
  -str, --extract-streams-to           extract all binary streams in the PDF to files in STREAM_DUMP_DIR then exit (requires pdf-parser.py)                                                            
STREAM_DUMP_DIR                                                                                                                                                                                        

PCT_CONFIDENCE and STREAM_DUMP_DIR are all alone in the universe with no map home.

For comparison this is how regular argparse handles it, placing the metavars on the same line as the argument they relate to.

FINE TUNING:
  Settings that affect aspects of the analyis and output

  --force-display-threshold PCT_CONFIDENCE
                        chardet.detect() scores encodings from 0-100 pct but only above this are displayed (default: 20.0)
  --force-decode-threshold PCT_CONFIDENCE
                        extremely high (AKA 'above this number') PCT_CONFIDENCE scores from chardet.detect() as to the likelihood some binary data was written with a particular encoding will cause
                        the pdfalyzer to do a force decode of that with that encoding. (chardet is a sophisticated libary; this is pdfalyzer's way of harnessing that intelligence) (default: 50.0)

FILE EXPORT:
  Export to various kinds of files

  -txt OUTPUT_DIR, --txt-output-to OUTPUT_DIR
                        write analysis to uncolored text files in OUTPUT_DIR (in addition to STDOUT)
  -svg OUTPUT_DIR, --export-svgs OUTPUT_DIR
                        export SVG images of the analysis to OUTPUT_DIR (in addition to STDOUT)
  -html OUTPUT_DIR, --export-html OUTPUT_DIR
                        export SVG images of the analysis to OUTPUT_DIR (in addition to STDOUT)
  -str STREAM_DUMP_DIR, --extract-streams-to STREAM_DUMP_DIR
                        extract all binary streams in the PDF to files in STREAM_DUMP_DIR then exit (requires pdf-parser.py)
  -pfx PREFIX, --file-prefix PREFIX
                        optional string to use as the prefix for exported files of any kind

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions