Skip to content

Commit 30b7a27

Browse files
mzuennimpsijm
authored andcommitted
[skel] Make source_name optional
1 parent afe6ded commit 30b7a27

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

bin/skel.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,13 @@ def new_problem() -> None:
128128
source_name = ask_variable_string(
129129
"source", variables.get("source", variables.get("name", "")), True
130130
)
131-
source_url = ask_variable_string("source url", variables.get("source_url", ""), True)
132-
variables["source"] = (
133-
f"source:\n name: {source_name}\n{f' url: {source_url}' if source_url else ' #url:'}"
134-
)
131+
if source_name:
132+
source_url = ask_variable_string("source url", variables.get("source_url", ""), True)
133+
variables["source"] = (
134+
f"source:\n name: {source_name}\n{f' url: {source_url}' if source_url else ' #url:'}\n"
135+
)
136+
else:
137+
variables["source"] = ""
135138

136139
variables["license"] = ask_variable_choice(
137140
"license", config.KNOWN_LICENSES, variables.get("license", None)

skel/problem/problem.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ name:
77
{%problemname%}
88
uuid: {%uuid%}
99
credits: {%author%}
10-
{%source%}
11-
license: {%license%}
10+
{%source%}license: {%license%}
1211
{%rights_owner%}
1312
# limits:
1413
# time_limit: 1.0

0 commit comments

Comments
 (0)