Skip to content

Commit 74cdb81

Browse files
committed
fix: proper handling of typer.Option in defaults
1 parent 365e410 commit 74cdb81

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

mitreattack/download_stix.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pooch
77
import typer
88
from loguru import logger
9+
from typing_extensions import Annotated
910

1011
from mitreattack import release_info
1112

@@ -191,20 +192,22 @@ def _validate_versions(versions: List[str], stix20: bool, stix21: bool):
191192

192193
@app.command()
193194
def download_attack_stix(
194-
download_dir: str = typer.Option(
195-
"attack-releases", "--download-dir", "-d", help="Folder to save downloaded STIX data."
196-
),
197-
all_versions: bool = typer.Option(
198-
False, "--all", "-a", help="Download all ATT&CK releases. Mutually exclusive with --version."
199-
),
200-
attack_versions: Optional[List[str]] = typer.Option(
201-
None,
202-
"--version",
203-
"-v",
204-
help="Download specific ATT&CK version(s). Can be specified multiple times. Mutually exclusive with --all.",
205-
),
206-
stix20: bool = typer.Option(True, help="Download STIX 2.0 data."),
207-
stix21: bool = typer.Option(False, help="Download STIX 2.1 data."),
195+
download_dir: Annotated[
196+
str, typer.Option("--download-dir", "-d", help="Folder to save downloaded STIX data.")
197+
] = "attack-releases",
198+
all_versions: Annotated[
199+
bool, typer.Option("--all", "-a", help="Download all ATT&CK releases. Mutually exclusive with --version.")
200+
] = False,
201+
attack_versions: Annotated[
202+
Optional[List[str]],
203+
typer.Option(
204+
"--version",
205+
"-v",
206+
help="Download specific ATT&CK version(s). Can be specified multiple times. Mutually exclusive with --all.",
207+
),
208+
] = None,
209+
stix20: Annotated[bool, typer.Option(help="Download STIX 2.0 data.")] = True,
210+
stix21: Annotated[bool, typer.Option(help="Download STIX 2.1 data.")] = False,
208211
):
209212
"""Download the ATT&CK STIX data from GitHub in JSON format.
210213

0 commit comments

Comments
 (0)