change argparse formatter

This commit is contained in:
Tino Schreiber 2023-09-26 09:58:18 +00:00
parent 420e377b3a
commit 8022daa8fe

View File

@ -39,7 +39,7 @@ def fix_repos(args):
repos.append(repo.full_name)
for r in repos:
r = 'opentelekomcloud-docs/gaussdb-nosql'
# r = 'opentelekomcloud-docs/gaussdb-nosql'
repo = g.get_repo(r)
path = workdir.joinpath(repo.name)
if path.exists() and path.is_dir():
@ -52,6 +52,8 @@ def fix_repos(args):
if file_absolute_path.exists():
with file_absolute_path.open('r') as file:
file_content = file.read()
# Pattern to match strings: description-file = README.rst
# and substitute with: description_file = README.rst
pattern = r"(.*)-(.*)\s*="
new_file_content = re.sub(pattern, r'\1_\2=', file_content)
break
@ -59,7 +61,8 @@ def fix_repos(args):
def main():
parser = argparse.ArgumentParser(
description="Fix setup.cfg"
description="Fix setup.cfg",
formatter_class=argparse.RawTextHelpFormatter
)
parser.add_argument(
"--branch",
@ -69,11 +72,11 @@ def main():
parser.add_argument(
"--commit-description",
default=(
"Update tox.ini && conf.py file\n\n"
"Update setup.cfg file\n\n"
"Performed-by: gitea/infra/hc-tools/"
"/test.py"
),
help="Commit description for the commit",
help="Commit description",
)
parser.add_argument(
"--file-name",
@ -83,16 +86,17 @@ def main():
)
parser.add_argument(
"--git-token",
help="Git Token for git Authentication"
help="Git token for git authentication or use env variable\n"
"\'GIT_TOKEN\'"
)
parser.add_argument(
"--target-environment",
required=True,
choices=['public', 'internal', 'public-swiss', 'internal-swiss'],
help="Environment to be used as a source\n"
help="Environment to be used as source\n"
"public: Github Org: opentelekomcloud-docs/\n"
"internal: Gitea Org: docs/\n"
"internal-swiss: Gitea Org: docs/\n"
"internal-swiss: Gitea Org: docs-swiss/\n"
"public-swiss: GitHub Org: opentelekomcloud-docs-swiss/\n"
)
parser.add_argument(