Skip to content

Commit

Permalink
Add help texts to the command options
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerklinger committed Sep 13, 2024
1 parent a8c472d commit 043e6f5
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions pynitrokey/cli/nk3/piv.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def info() -> None:
"--current-admin-key",
type=click.STRING,
default="010203040506070801020304050607080102030405060708",
help="Current admin key.",
)
@click.argument(
"new-admin-key",
Expand Down Expand Up @@ -126,12 +127,14 @@ def change_admin_key(current_admin_key: str, new_admin_key: str) -> None:
type=click.STRING,
prompt="Enter the PIN",
hide_input=True,
help="Current PIN.",
)
@click.option(
"--new-pin",
type=click.STRING,
prompt="Enter the PIN",
hide_input=True,
help="New PIN.",
)
def change_pin(current_pin: str, new_pin: str) -> None:
device = PivApp()
Expand All @@ -145,12 +148,14 @@ def change_pin(current_pin: str, new_pin: str) -> None:
type=click.STRING,
prompt="Enter the current PUK",
hide_input=True,
help="Current PUK.",
)
@click.option(
"--new-puk",
type=click.STRING,
prompt="Enter the new PUK",
hide_input=True,
help="New PUK.",
)
def change_puk(current_puk: str, new_puk: str) -> None:
device = PivApp()
Expand All @@ -164,12 +169,14 @@ def change_puk(current_puk: str, new_puk: str) -> None:
type=click.STRING,
prompt="Enter the PUK",
hide_input=True,
help="Current PUK.",
)
@click.option(
"--new-pin",
type=click.STRING,
prompt="Enter the new PIN",
hide_input=True,
help="New PIN.",
)
def reset_retry_counter(puk: str, new_pin: str) -> None:
device = PivApp()
Expand Down Expand Up @@ -223,6 +230,7 @@ def factory_reset() -> None:
"--admin-key",
type=click.STRING,
default="010203040506070801020304050607080102030405060708",
help="Current admin key",
)
@click.option(
"--key",
Expand Down Expand Up @@ -256,36 +264,43 @@ def factory_reset() -> None:
case_sensitive=False,
),
default="9A",
help="Key slot for operation.",
)
@click.option(
"--algo",
type=click.Choice(["rsa2048", "nistp256"], case_sensitive=False),
default="nistp256",
help="Algorithm for the key.",
)
@click.option(
"--domain-component",
type=click.STRING,
multiple=True,
help="Domain component for the certificate signing request.",
)
@click.option(
"--subject-name",
type=click.STRING,
multiple=True,
help="Subject name for the certificate signing request.",
)
@click.option(
"--subject-alt-name-upn",
type=click.STRING,
help="Subject alternative name (UPN) for the certificate signing request.",
)
@click.option(
"--pin",
type=click.STRING,
prompt="Enter the PIN",
hide_input=True,
help="Current PIN.",
)
@click.option(
"--path",
type=click.Path(allow_dash=True),
default="-",
help="Write certificate signing request to path.",
)
def generate_key(
admin_key: str,
Expand Down Expand Up @@ -572,7 +587,10 @@ def generate_key(
default="010203040506070801020304050607080102030405060708",
)
@click.option(
"--format", type=click.Choice(["DER", "PEM"], case_sensitive=False), default="PEM"
"--format",
type=click.Choice(["DER", "PEM"], case_sensitive=False),
default="PEM",
help="Format of certificate.",
)
@click.option(
"--key",
Expand Down Expand Up @@ -606,11 +624,13 @@ def generate_key(
case_sensitive=False,
),
default="9A",
help="Key slot for operation.",
)
@click.option(
"--path",
type=click.Path(allow_dash=True),
default="-",
help="Write certificate to path.",
)
def write_certificate(admin_key: str, format: str, key: str, path: str) -> None:
try:
Expand Down Expand Up @@ -649,6 +669,7 @@ def write_certificate(admin_key: str, format: str, key: str, path: str) -> None:
"--format",
type=click.Choice(["DER", "PEM"], case_sensitive=False),
default="PEM",
help="Format of certificate.",
)
@click.option(
"--key",
Expand Down Expand Up @@ -682,8 +703,14 @@ def write_certificate(admin_key: str, format: str, key: str, path: str) -> None:
case_sensitive=False,
),
default="9A",
help="Key slot for operation.",
)
@click.option(
"--path",
type=click.Path(allow_dash=True),
default="-",
help="Read certificate from path.",
)
@click.option("--path", type=click.Path(allow_dash=True), default="-")
def read_certificate(format: str, key: str, path: str) -> None:
device = PivApp()

Expand Down

0 comments on commit 043e6f5

Please sign in to comment.