Skip to content

Commit e808221

Browse files
committed
change search-update name/filter options/parameters to match search UI
1 parent 8308fbd commit e808221

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
@@ -468,20 +468,28 @@ async def search_delete(ctx, search_id):
468468
@translate_exceptions
469469
@coro
470470
@click.argument('search_id')
471-
@click.argument('name')
472471
@click.argument("item_types",
473472
type=types.CommaSeparatedString(),
474473
callback=check_item_types)
475-
@click.argument('filter', type=types.JSON())
474+
@click.option(
475+
'--filter',
476+
type=types.JSON(),
477+
required=True,
478+
help="""Filter to apply to search. Can be a json string, filename,
479+
or '-' for stdin.""")
480+
@click.option('--name',
481+
type=str,
482+
required=True,
483+
help='Name of the saved search.')
476484
@click.option('--daily-email',
477485
is_flag=True,
478486
help='Send a daily email when new results are added.')
479487
@pretty
480488
async def search_update(ctx,
481489
search_id,
482-
name,
483490
item_types,
484491
filter,
492+
name,
485493
daily_email,
486494
pretty):
487495
"""Update a saved search with the given search request.
@@ -491,9 +499,9 @@ async def search_update(ctx,
491499
"""
492500
async with data_client(ctx) as cl:
493501
items = await cl.update_search(search_id,
494-
name,
495502
item_types,
496503
filter,
504+
name,
497505
daily_email)
498506
echo_json(items, pretty)
499507

tests/integration/test_data_cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -900,9 +900,9 @@ def test_search_update_success(invoke,
900900
result = invoke([
901901
'search-update',
902902
search_id,
903-
name,
904903
item_types,
905-
json.dumps(search_filter)
904+
f'--filter={json.dumps(search_filter)}',
905+
f'--name={name}'
906906
])
907907

908908
assert not result.exception
@@ -921,9 +921,9 @@ def test_search_update_fail(invoke, search_id, search_filter):
921921
result = invoke([
922922
'search-update',
923923
search_id,
924-
name,
925924
item_types,
926-
json.dumps(search_filter)
925+
f'--filter={json.dumps(search_filter)}',
926+
f'--name={name}'
927927
])
928928

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

0 commit comments

Comments
 (0)