Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/sist/argspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
from dataclasses import dataclass
from typing import Any

ALGORITHM_CHOICES = ("M", "Z", "C", "A")
from sist.transitions import ALGORITHMS

ALGORITHM_CHOICES = tuple(ALGORITHMS)


@dataclass(frozen=True)
Expand Down Expand Up @@ -131,6 +133,16 @@ class ArgSpec:
default=None,
help="Write output to this file instead of printing to stdout.",
),
ArgSpec(
dest="json_file",
flags=("--json",),
type=str,
default=None,
help=(
"Write the result as structured JSON to this file. The text output "
"is then only written if -o is also given."
),
),
)


Expand Down
7 changes: 7 additions & 0 deletions src/sist/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def main(argv: list[str] | None = None) -> None:
argument_parser = SistArgumentParser()
parser = argument_parser.build_parser()
args = parser.parse_args(argv)
program = Path(sys.argv[0]).name
command = [
program if argv is None and program != "__main__.py" else parser.prog,
*(sys.argv[1:] if argv is None else argv),
]

try:
argument_parser.validate(args)
Expand All @@ -62,6 +67,8 @@ def main(argv: list[str] | None = None) -> None:
print_parameters=args.print_parameters,
print_ensemble_average=args.print_ensemble_average,
output_file=args.output_file,
json_file=args.json_file,
command=command,
)
runner.run()
except Exception:
Expand Down
Loading
Loading