Skip to content

Commit ed415f4

Browse files
authored
Merge pull request #406 from gm3dmo/issue321
Pass arguments directly to the string template
2 parents 4fad2ce + af4b6cc commit ed415f4

File tree

1 file changed

+29
-61
lines changed

1 file changed

+29
-61
lines changed

configure.py

Lines changed: 29 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -490,71 +490,11 @@ def main(args):
490490
else:
491491
args.webhook_url = input(f"Enter webhook url: ")
492492

493-
values = {
494-
"token": args.token,
495-
"hostname": args.hostname,
496-
"path_prefix": args.path_prefix,
497-
"graphql_path_prefix": args.graphql_path_prefix,
498-
"webhook_url": args.webhook_url,
499-
"private_pem_file": args.private_pem_file,
500-
"org": args.org,
501-
"default_repo_visibility" : args.default_repo_visibility,
502-
"enterprise_name": args.enterprise_name,
503-
"base_branch": args.base_branch,
504-
"delete_branch_on_merge": args.delete_branch_on_merge,
505-
"pr_approver_token": args.pr_approver_token,
506-
"pr_approver_name": args.pr_approver_name,
507-
"default_app_id": args.app_id,
508-
"default_app_name": args.default_app_name,
509-
"default_installation_id": args.installation_id,
510-
"private_key_pem_file": args.private_pem_file,
511-
"client_id": args.client_id,
512-
"app_client_secret": args.app_client_secret,
513-
"admin_user": args.admin_user,
514-
"admin_password": args.admin_password,
515-
"mgmt_password": args.mgmt_password,
516-
"mgmt_port": args.mgmt_port,
517-
"team_name": args.team_name,
518-
"team_slug": args.team_slug,
519-
"team_members": args.team_members,
520-
"team_admin": args.team_admin,
521-
"org_owner": args.org_owner,
522-
"org_members": args.org_members,
523-
"default_committer": args.default_committer,
524-
"repo_name": args.repo_name,
525-
"number_of_users_to_create_on_ghes": args.number_of_users_to_create_on_ghes,
526-
"runner_version": args.runner_version,
527-
"runner_os": args.runner_os,
528-
"runner_platform": args.runner_platform,
529-
"number_of_orgs": args.number_of_orgs,
530-
"number_of_repos": args.number_of_repos,
531-
"number_of_teams": args.number_of_teams,
532-
"number_of_branches": args.number_of_branches,
533-
"curl_custom_flags": args.curl_custom_flags,
534-
"allow_auto_merge": args.allow_auto_merge,
535-
"preferred_client": args.preferred_client,
536-
"preferred_browser": args.preferred_browser,
537-
"preferred_browser_mode": args.preferred_browser_mode,
538-
"chrome_profile": args.chrome_profile,
539-
"github_api_version": args.github_api_version,
540-
"http_protocol": args.http_protocol,
541-
"x_client_id": args.x_client_id,
542-
"x_client_secret": args.x_client_secret,
543-
"ent_app_id": args.ent_app_id,
544-
"ent_app_name": args.ent_app_name,
545-
"ent_app_client_id": args.ent_app_client_id,
546-
"ent_app_client_secret": args.ent_app_client_secret,
547-
"ent_app_public_link": args.ent_app_public_link,
548-
"ent_app_client_secret": args.ent_app_client_secret,
549-
"ent_app_private_pem": args.ent_app_private_pem,
550-
"ent_app_installation_id": args.ent_installation_id
551-
}
552-
553493
out_filename = ".gh-api-examples.conf"
554494

555495
try:
556496
with open(out_filename, "w") as out_file:
557-
out_file.write(t.substitute(values))
497+
out_file.write(t.substitute(vars(args)))
558498
logger.info(
559499
f"\n{bcolors.OKGREEN}Configuration run is complete. Created {out_filename}"
560500
)
@@ -832,6 +772,13 @@ def main(args):
832772
default="",
833773
help="The name of your enterprise.",
834774
)
775+
parser.add_argument(
776+
"--ent-app-id",
777+
action="store",
778+
dest="ent_app_installation_id",
779+
default="1",
780+
help="The id of your enterprise app installation.",
781+
)
835782
parser.add_argument(
836783
"--pr-approver-token",
837784
action="store",
@@ -902,6 +849,27 @@ def main(args):
902849
default="https",
903850
help="Mostly always https",
904851
)
852+
parser.add_argument(
853+
"--private-key-pem-file",
854+
action="store",
855+
dest="private_key_pem_file",
856+
default="bob.pem",
857+
help="Path to an app pem file",
858+
)
859+
parser.add_argument(
860+
"--default-app-id",
861+
action="store",
862+
dest="default_app_id",
863+
default="1",
864+
help="an app id",
865+
)
866+
parser.add_argument(
867+
"--default-installation-id",
868+
action="store",
869+
dest="default_installation_id",
870+
default="1",
871+
help="an app installation id",
872+
)
905873

906874
args = parser.parse_args()
907875

0 commit comments

Comments
 (0)