[3/4] dts: show help when DTS is ran without args
Checks
Commit Message
This commit changes the default behaviour of DTS, making it so that the
user automatically sees the help and usage page when running it without
any arguments set. Instead of being welcomed by an error message.
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
Signed-off-by: Luca Vizzarro <luca.vizzarro@arm.com>
---
dts/framework/settings.py | 6 ++++++
1 file changed, 6 insertions(+)
@@ -71,6 +71,7 @@
import argparse
import os
+import sys
from collections.abc import Callable, Iterable, Sequence
from dataclasses import dataclass, field
from pathlib import Path
@@ -315,6 +316,11 @@ def get_settings() -> Settings:
The inputs are taken from the command line and from environment variables.
"""
+
+ if len(sys.argv) == 1:
+ _get_parser().print_help()
+ sys.exit(1)
+
parsed_args = _get_parser().parse_args()
return Settings(
config_file_path=parsed_args.config_file,