Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --yaml-path to ctf challenge add to add a challenge.yml path to the challenge config key #92

Merged
merged 1 commit into from
May 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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