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