From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A89DD4399C; Mon, 22 Jan 2024 19:26:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6505E42D2B; Mon, 22 Jan 2024 19:26:38 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 6908840E13 for ; Mon, 22 Jan 2024 19:26:36 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C0CE1FB; Mon, 22 Jan 2024 10:27:22 -0800 (PST) Received: from localhost.localdomain (unknown [10.57.90.210]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5346A3F762; Mon, 22 Jan 2024 10:26:35 -0800 (PST) From: Luca Vizzarro To: dev@dpdk.org Cc: Luca Vizzarro , =?UTF-8?q?Juraj=20Linke=C5=A1?= , Paul Szczepanek Subject: [PATCH 3/4] dts: show help when DTS is ran without args Date: Mon, 22 Jan 2024 18:26:10 +0000 Message-Id: <20240122182611.1904974-4-luca.vizzarro@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240122182611.1904974-1-luca.vizzarro@arm.com> References: <20240122182611.1904974-1-luca.vizzarro@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Signed-off-by: Luca Vizzarro --- dts/framework/settings.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dts/framework/settings.py b/dts/framework/settings.py index acfe5cad44..5809fd4e91 100644 --- a/dts/framework/settings.py +++ b/dts/framework/settings.py @@ -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, -- 2.34.1