Skip to content

Commit 2838f9a

Browse files
committed
feat(misc): changelog;
- Added change log file.
1 parent 9999f55 commit 2838f9a

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

changes/218.canada.changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added `--list` and `--quiet` options to the `datastore purge` command.

ckanext/datastore/cli.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,29 +168,32 @@ def purge(list: bool = False, quiet: bool = False):
168168
)
169169
except logic.NotFound:
170170
resource_id_list.append(record['name'])
171-
click.echo("Resource '%s' orphaned - queued for drop" %
172-
record['name'])
171+
if not list:
172+
click.echo("Resource '%s' orphaned - queued for drop" %
173+
record['name'])
173174
continue
174175
except KeyError:
175176
continue
176177
# (canada fork only): more options and state=deleted handling
177178
# TODO: upstream contrib!!
178179
if res['state'] == 'deleted':
179180
resource_id_list.append(record['name'])
180-
click.echo("Resource '%s' deleted - queued for drop" %
181-
record['name'])
181+
if not list:
182+
click.echo("Resource '%s' deleted - queued for drop" %
183+
record['name'])
182184
if pkg['state'] == 'deleted':
183185
resource_id_list.append(record['name'])
184-
click.echo("Package '%s' deleted - queued for drop" %
185-
pkg['id'])
186+
if not list:
187+
click.echo("Package '%s' deleted - queued for drop" %
188+
pkg['id'])
186189

187-
orphaned_table_count = len(resource_id_list)
188190
# (canada fork only): more options and state=deleted handling
189191
# TODO: upstream contrib!!
190192
if list:
191193
click.echo('\n'.join(resource_id_list))
192194
return
193195

196+
orphaned_table_count = len(resource_id_list)
194197
click.echo('%d orphaned tables found.' % orphaned_table_count)
195198

196199
if not orphaned_table_count:

0 commit comments

Comments
 (0)