From a71d6dc3409413141fc17b19a01d7e1d376b3a26 Mon Sep 17 00:00:00 2001 From: Gopesh Bhardwaj Date: Tue, 19 Nov 2024 08:21:02 +0530 Subject: [PATCH] Format rocporfv3 help (#1199) * Format rocporfv3 help * python formatter fix [ROCm/rocprofiler-sdk commit: a976ed0783e0b7db055e3f12629f4d38be25c070] --- projects/rocprofiler-sdk/source/bin/rocprofv3.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/projects/rocprofiler-sdk/source/bin/rocprofv3.py b/projects/rocprofiler-sdk/source/bin/rocprofv3.py index 4196123543..122861cc60 100755 --- a/projects/rocprofiler-sdk/source/bin/rocprofv3.py +++ b/projects/rocprofiler-sdk/source/bin/rocprofv3.py @@ -31,6 +31,16 @@ def fatal_error(msg, exit_code=1): sys.exit(exit_code) +def format_help(formatter, w=120, h=40): + """Return a wider HelpFormatter, if possible.""" + try: + kwargs = {"width": w, "max_help_position": h} + formatter(None, **kwargs) + return lambda prog: formatter(prog, **kwargs) + except TypeError: + return formatter + + def strtobool(val): """Convert a string representation of truth to true or false. True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values @@ -80,7 +90,7 @@ For MPI applications (or other job launchers such as SLURM), place rocprofv3 ins description="ROCProfilerV3 Run Script", usage="%(prog)s [options] -- [application options]", epilog=usage_examples, - formatter_class=argparse.RawTextHelpFormatter, + formatter_class=format_help(argparse.RawTextHelpFormatter), ) def add_parser_bool_argument(gparser, *args, **kwargs):