From 75703e9bf4eaa19eb24faa09b91124194e2c2443 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Sun, 29 May 2022 19:05:00 -0400 Subject: [PATCH] Add `--yaml-path` to `ctf challenge add` to add a challenge.yml path to the challenge config key --- ctfcli/cli/challenges.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ctfcli/cli/challenges.py b/ctfcli/cli/challenges.py index 561a2d5..fd960cb 100644 --- a/ctfcli/cli/challenges.py +++ b/ctfcli/cli/challenges.py @@ -53,7 +53,7 @@ def templates(self): Templates().list() - def add(self, repo): + def add(self, repo, yaml_path=None): config = load_config() if repo.endswith(".git"): @@ -67,7 +67,13 @@ def add(self, repo): challenge_path = challenge_path / base_repo_path print(challenge_path) - config["challenges"][str(challenge_path)] = repo + # If a custom yaml_path is specified we add it to our challenge_key + if yaml_path: + challenge_key = str(challenge_path / yaml_path) + else: + challenge_key = str(challenge_path) + + config["challenges"][challenge_key] = repo head_branch = get_git_repo_head_branch(repo) subprocess.call(