@cli.command('set-workspace')
@click.argument("workspace", default="@-", required=False)
@click.option('--id', help='If provided, update the workspace with this id')
@click.option('--aoi', help='The geometry to use')
@click.option('--name', help='Workspace name')
@click.option('--create', is_flag=True, help='Specify workspace creation')
@click.option('--where', nargs=3, multiple=True,
              help=('Provide additional search criteria. See '
                    'https://www.planet.com/docs/v0/scenes/#metadata for '
                    'search metadata fields.'))
def set_workspace(id, aoi, name, create, workspace, where):
    '''Create or modify a workspace'''
    workspace = read(workspace)
    try:
        workspace = json.loads(workspace) if workspace else None
    except __HOLE__:
        raise click.ClickException('workspace must be JSON')

    cl = client()

    if workspace is None and id:
        workspace = cl.get_workspace(id).get()

    # what workspace id are we working with
    if not id:
        id = workspace.get('id', None)
    if create:
        id = None

    aoi = read_aoi(aoi)
    if aoi:
        geom = api.utils.geometry_from_json(aoi)
        if geom is None:
            raise click.ClickException('unable to find geometry in aoi')
        workspace['filters'] = {
            'geometry': {
                'intersects': geom
            }
        }
    if name:
        workspace['name'] = name

    if where:
        if 'filters' not in workspace:
            workspace['filters'] = {}
        filters = workspace['filters']
        for k, c, v in where:
            if k not in filters:
                filters[k] = {}
            group = filters.get(k)
            if v == '-' and c in group:
                group.pop(c)
            else:
                group[c] = v
            if not group:
                filters.pop(k)

    if not workspace:
        raise click.ClickException('nothing to do')
    echo_json_response(call_and_wrap(cl.set_workspace,
                       workspace, id), pretty)
dataset/ETHPy150Open planetlabs/planet-client-python/planet/scripts/__init__.py/set_workspace