Skip to content

Commit 755acf8

Browse files
author
Miłosz Skaza
authored
add directory option to ctfcli add (#123)
This adds `--directory` argument to `ctfcli add` - useful for grouping challenges into separate directories like: `web/challenge1`.
1 parent a9d6f11 commit 755acf8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ctfcli/cli/challenges.py

+4-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, yaml_path=None):
56+
def add(self, repo, directory=None, yaml_path=None):
5757
config = load_config()
5858

5959
if repo.endswith(".git"):
@@ -63,9 +63,11 @@ def add(self, repo, yaml_path=None):
6363
# Get new directory that will add the git subtree
6464
base_repo_path = Path(os.path.basename(repo).rsplit(".", maxsplit=1)[0])
6565

66+
if directory:
67+
base_repo_path = directory / base_repo_path
68+
6669
# Join targets
6770
challenge_path = challenge_path / base_repo_path
68-
print(challenge_path)
6971

7072
# If a custom yaml_path is specified we add it to our challenge_key
7173
if yaml_path:

0 commit comments

Comments
 (0)