Skip to content

Commit

Permalink
Add --yaml-path to ctf challenge add to add a challenge.yml path …
Browse files Browse the repository at this point in the history
…to the challenge config key (CTFd#92)

* Add `--yaml-path` to `ctf challenge add` to add a challenge.yml path to the challenge config key
* Closes CTFd#90
  • Loading branch information
ColdHeat authored May 29, 2022
1 parent 192b1de commit c27282b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ctfcli/cli/challenges.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand All @@ -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(
Expand Down

0 comments on commit c27282b

Please sign in to comment.