Skip to content

Commit c27282b

Browse files
authored
Add --yaml-path to ctf challenge add to add a challenge.yml path to the challenge config key (#92)
* Add `--yaml-path` to `ctf challenge add` to add a challenge.yml path to the challenge config key * Closes #90
1 parent 192b1de commit c27282b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ctfcli/cli/challenges.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def templates(self):
5353

5454
Templates().list()
5555

56-
def add(self, repo):
56+
def add(self, repo, yaml_path=None):
5757
config = load_config()
5858

5959
if repo.endswith(".git"):
@@ -67,7 +67,13 @@ def add(self, repo):
6767
challenge_path = challenge_path / base_repo_path
6868
print(challenge_path)
6969

70-
config["challenges"][str(challenge_path)] = repo
70+
# If a custom yaml_path is specified we add it to our challenge_key
71+
if yaml_path:
72+
challenge_key = str(challenge_path / yaml_path)
73+
else:
74+
challenge_key = str(challenge_path)
75+
76+
config["challenges"][challenge_key] = repo
7177

7278
head_branch = get_git_repo_head_branch(repo)
7379
subprocess.call(

0 commit comments

Comments
 (0)