Skip to content

Commit 8d860da

Browse files
nethsm: Add --prefix option to list command
1 parent aab0ee2 commit 8d860da

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pynitrokey/cli/nethsm.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,14 +576,17 @@ def metrics(ctx: Context) -> None:
576576
type=str,
577577
help="Filter keys by tags for respective user",
578578
)
579+
@click.option("-p", "--prefix", type=str, help="Only list keys with the given prefix")
579580
@click.pass_context
580-
def list_keys(ctx: Context, details: bool, filter: Optional[str]) -> None:
581+
def list_keys(
582+
ctx: Context, details: bool, filter: Optional[str], prefix: Optional[str]
583+
) -> None:
581584
"""List all keys on the NetHSM.
582585
583586
This command requires authentication as a user with the Administrator or
584587
Operator role."""
585588
with connect(ctx) as nethsm:
586-
key_ids = nethsm.list_keys(filter)
589+
key_ids = nethsm.list_keys(filter, prefix=prefix)
587590

588591
print(f"Keys on NetHSM {nethsm.host}:")
589592
print()

0 commit comments

Comments
 (0)