From ea4ff4dbc908c69aa64d8d00c4a474686befd874 Mon Sep 17 00:00:00 2001 From: jakub-nt <175944085+jakub-nt@users.noreply.github.com> Date: Tue, 5 Aug 2025 20:18:02 +0200 Subject: [PATCH] Standardized whitespace style when generating manpage Previously, generating manpage could result in varying whitespace, as by default, argparse.py looks at the `COLUMNS` environment variable to determine line length. Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com> --- cfbs/args.py | 12 ++++++++++-- cfbs/man_generator.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cfbs/args.py b/cfbs/args.py index bcf5271f..c25453cf 100644 --- a/cfbs/args.py +++ b/cfbs/args.py @@ -79,9 +79,17 @@ def __call__(self, parser, namespace, values, option_string=None): @cache -def get_arg_parser(): +def get_arg_parser(whitespace_for_manual=False): command_list = commands.get_command_names() - parser = argparse.ArgumentParser(prog="cfbs", description="CFEngine Build System.") + CFBS_DESCRIPTION = "CFEngine Build System." + if whitespace_for_manual: + parser = argparse.ArgumentParser( + prog="cfbs", + description=CFBS_DESCRIPTION, + formatter_class=argparse.RawTextHelpFormatter, + ) + else: + parser = argparse.ArgumentParser(prog="cfbs", description=CFBS_DESCRIPTION) parser.add_argument( "command", metavar="cmd", diff --git a/cfbs/man_generator.py b/cfbs/man_generator.py index 25cac4dd..ca2e718c 100644 --- a/cfbs/man_generator.py +++ b/cfbs/man_generator.py @@ -11,7 +11,7 @@ def generate_man_page(): - manpage = Manpage(get_arg_parser()) + manpage = Manpage(get_arg_parser(whitespace_for_manual=True)) manpage.manual = "CFEngine Build System manual" manpage.description = ( "combines multiple modules into 1 policy set to deploy on your infrastructure. "