Skip to content

Commit

Permalink
nk3/nkpk: Fix device listing
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-nitrokey committed Jan 31, 2024
1 parent 9703773 commit 562829e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pynitrokey/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ def version():


def _list():
from .nk3 import _list as list_nk3
from .nkpk import _list as list_nkpk

fido2.commands["list"].callback()
start.commands["list"].callback()
nk3.commands["list"].callback()
nkpk.commands["list"].callback()
list_nk3()
list_nkpk()
# TODO add other handled models


Expand Down
4 changes: 4 additions & 0 deletions pynitrokey/cli/nk3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def nk3(ctx: click.Context, path: Optional[str]) -> None:
trussed.add_commands(nk3)


def _list() -> None:
trussed._list(Context(None))


@nk3.command()
@click.argument("path", default=".")
@click.option(
Expand Down
4 changes: 4 additions & 0 deletions pynitrokey/cli/nkpk.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ def nkpk(ctx: click.Context, path: Optional[str]) -> None:

# shared Trussed commands
trussed.add_commands(nkpk)


def _list() -> None:
trussed._list(Context(None))
4 changes: 4 additions & 0 deletions pynitrokey/cli/trussed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ def add_commands(group: click.Group) -> None:
@click.pass_obj
def list(ctx: Context[Bootloader, Device]) -> None:
"""List all devices."""
return _list(ctx)


def _list(ctx: Context[Bootloader, Device]) -> None:
local_print(f":: '{ctx.device_name}' keys")
for device in ctx.list_all():
with device as device:
Expand Down

0 comments on commit 562829e

Please sign in to comment.