Skip to content

Commit 4712872

Browse files
refactor: dataset add
1 parent 8cc2834 commit 4712872

File tree

4 files changed

+135
-154
lines changed

4 files changed

+135
-154
lines changed

renku/core/commands/dataset.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,12 @@ def add_to_dataset(
166166
urlscontext=contextlib.nullcontext
167167
):
168168
"""Add data to a dataset."""
169-
if sources or destination:
170-
if len(urls) == 0:
171-
raise UsageError('No URL is specified')
172-
elif len(urls) > 1:
173-
raise UsageError(
174-
'Cannot add multiple URLs with --source or --destination'
175-
)
169+
if len(urls) == 0:
170+
raise UsageError('No URL is specified')
171+
if (sources or destination) and len(urls) > 1:
172+
raise UsageError(
173+
'Cannot add multiple URLs with --source or --destination'
174+
)
176175

177176
# check for identifier before creating the dataset
178177
identifier = extract_doi(
@@ -183,7 +182,7 @@ def add_to_dataset(
183182
name=name, identifier=identifier, create=create
184183
) as dataset:
185184
with urlscontext(urls) as bar:
186-
message = client.add_data_to_dataset(
185+
warning_message = client.add_data_to_dataset(
187186
dataset,
188187
bar,
189188
link=link,
@@ -193,8 +192,8 @@ def add_to_dataset(
193192
ref=ref
194193
)
195194

196-
if message:
197-
click.echo(message)
195+
if warning_message:
196+
click.echo(WARNING + warning_message)
198197

199198
if with_metadata:
200199
for file_ in with_metadata.files:

0 commit comments

Comments
 (0)