Skip to content

Commit

Permalink
allow partial applications
Browse files Browse the repository at this point in the history
  • Loading branch information
zardus committed Nov 13, 2024
1 parent ee6f425 commit ab80b83
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pwnshop/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,13 @@ def handle_apply(args):
build_image = c.get('build_image', y.get('build_image', None))
verify_image = c.get('verify_image', y.get('verify_image', None))

if args.challenges and c['id'] not in args.challenges and not any(cc.startswith(c['id']+":") for cc in args.challenges):
continue

for v in range(variants):
if args.challenges and c['id'] not in args.challenges and f"{c['id']}:{v}" not in args.challenges:
continue

out_dir = f"{os.path.dirname(args.yaml)}/{c['id']}/_{v}"
print(f"Building {c['id']} variant {v} into {out_dir}.")
os.makedirs(out_dir, exist_ok=True)
Expand Down Expand Up @@ -328,7 +334,7 @@ def main():
)

# common to all single-challenge commands
for subparser in [ command_render, command_build, command_verify ]:
for subparser in [ command_render, command_build, command_verify, command_apply ]:
subparser.add_argument("challenges", help="the challenges, as multiple ChallengeClassName or ModuleName:level_number. Default: all challenges.", nargs="*")

parser.epilog = f"""Commands usage:\n\t{command_render.format_usage()}\t{command_build.format_usage()}\t{command_verify.format_usage()}"""
Expand Down

0 comments on commit ab80b83

Please sign in to comment.