that's too much!

This commit is contained in:
2024-12-19 20:22:56 -08:00
parent 0020a609dd
commit 32cd60e92b
8443 changed files with 1446950 additions and 42 deletions

View File

@@ -0,0 +1,30 @@
import click
import logging
import fiona
from fiona.fio import with_context_env
logger = logging.getLogger(__name__)
@click.command(help="Remove a datasource or an individual layer.")
@click.argument("input", required=True)
@click.option("--layer", type=str, default=None, required=False, help="Name of layer to remove.")
@click.option("--yes", is_flag=True)
@click.pass_context
@with_context_env
def rm(ctx, input, layer, yes):
if layer is None:
kind = "datasource"
else:
kind = "layer"
if not yes:
click.confirm(f"The {kind} will be removed. Are you sure?", abort=True)
try:
fiona.remove(input, layer=layer)
except Exception:
logger.exception(f"Failed to remove {kind}.")
raise click.Abort()