From 10fac429543933f24901570d2fed06ea26bd1031 Mon Sep 17 00:00:00 2001 From: Leonardo Schwarz Date: Mon, 26 Aug 2024 14:08:49 +0200 Subject: [PATCH] bfabric_delete.py allow passing multiple IDs --- bfabric/scripts/bfabric_delete.py | 6 +++--- docs/changelog.md | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bfabric/scripts/bfabric_delete.py b/bfabric/scripts/bfabric_delete.py index 3826f8ac..aa7e1df4 100755 --- a/bfabric/scripts/bfabric_delete.py +++ b/bfabric/scripts/bfabric_delete.py @@ -16,7 +16,7 @@ from bfabric import Bfabric -def bfabric_delete(client: Bfabric, endpoint: str, id: int) -> None: +def bfabric_delete(client: Bfabric, endpoint: str, id: list[int]) -> None: """Deletes the object with id `id` from the `endpoint`.""" res = client.delete(endpoint=endpoint, id=id).to_list_dict() print(json.dumps(res, indent=2)) @@ -26,8 +26,8 @@ def main() -> None: """Parses arguments and calls `bfabric_delete`.""" client = Bfabric.from_config() parser = argparse.ArgumentParser() - parser.add_argument("endpoint", help="endpoint", choices=bfabric.endpoints) - parser.add_argument("id", help="id", type=int) + parser.add_argument("endpoint", help="endpoint", type=str) + parser.add_argument("id", help="id", type=int, nargs="+") args = parser.parse_args() bfabric_delete(client=client, endpoint=args.endpoint, id=args.id) diff --git a/docs/changelog.md b/docs/changelog.md index 3e260f05..6bc35e99 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -17,6 +17,7 @@ Versioning currently follows `X.Y.Z` where ### Changed - `bfabric_read.py` prints non-output information exclusively through logger. +- `bfabric_delete.py` accepts multiple ids at once and does not restrict entity types anymore. ## \[1.13.5\] - 2024-08-13