Skip to content

Commit 1b12987

Browse files
authored
Merge pull request #898 from planetlabs/search-update-890
change search-update name/filter options/parameters to match search UI
2 parents 7e807cb + e808221 commit 1b12987

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

planet/cli/data.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,20 +476,28 @@ async def search_delete(ctx, search_id):
476476
@translate_exceptions
477477
@coro
478478
@click.argument('search_id')
479-
@click.argument('name')
480479
@click.argument("item_types",
481480
type=types.CommaSeparatedString(),
482481
callback=check_item_types)
483-
@click.argument('filter', type=types.JSON())
482+
@click.option(
483+
'--filter',
484+
type=types.JSON(),
485+
required=True,
486+
help="""Filter to apply to search. Can be a json string, filename,
487+
or '-' for stdin.""")
488+
@click.option('--name',
489+
type=str,
490+
required=True,
491+
help='Name of the saved search.')
484492
@click.option('--daily-email',
485493
is_flag=True,
486494
help='Send a daily email when new results are added.')
487495
@pretty
488496
async def search_update(ctx,
489497
search_id,
490-
name,
491498
item_types,
492499
filter,
500+
name,
493501
daily_email,
494502
pretty):
495503
"""Update a saved search with the given search request.
@@ -499,9 +507,9 @@ async def search_update(ctx,
499507
"""
500508
async with data_client(ctx) as cl:
501509
items = await cl.update_search(search_id,
502-
name,
503510
item_types,
504511
filter,
512+
name,
505513
daily_email)
506514
echo_json(items, pretty)
507515

tests/integration/test_data_cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,9 @@ def test_search_update_success(invoke,
906906
result = invoke([
907907
'search-update',
908908
search_id,
909-
name,
910909
item_types,
911-
json.dumps(search_filter)
910+
f'--filter={json.dumps(search_filter)}',
911+
f'--name={name}'
912912
])
913913

914914
assert not result.exception
@@ -927,9 +927,9 @@ def test_search_update_fail(invoke, search_id, search_filter):
927927
result = invoke([
928928
'search-update',
929929
search_id,
930-
name,
931930
item_types,
932-
json.dumps(search_filter)
931+
f'--filter={json.dumps(search_filter)}',
932+
f'--name={name}'
933933
])
934934

935935
assert result.output.startswith("Error")

0 commit comments

Comments
 (0)