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 98FBF42378; Mon, 9 Jan 2023 07:56:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 160E142D1E; Mon, 9 Jan 2023 07:56:13 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 185BC4067C for ; Mon, 9 Jan 2023 07:56:08 +0100 (CET) Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nr4S912QQznVCG; Mon, 9 Jan 2023 14:54:33 +0800 (CST) Received: from localhost.localdomain (10.28.79.22) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 9 Jan 2023 14:56:05 +0800 From: Huisong Li To: CC: , , , , , , Subject: [PATCH 1/2] usertools: use argparse module to get input parameter Date: Mon, 9 Jan 2023 14:55:46 +0800 Message-ID: <20230109065547.8819-2-lihuisong@huawei.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20230109065547.8819-1-lihuisong@huawei.com> References: <20230109065547.8819-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.28.79.22] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected 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 The telemetry client script uses argparse module to get input parameter. Signed-off-by: Huisong Li --- usertools/dpdk-telemetry-client.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetry-client.py index df41d04fbe..fd69955b32 100755 --- a/usertools/dpdk-telemetry-client.py +++ b/usertools/dpdk-telemetry-client.py @@ -6,6 +6,7 @@ import os import sys import time +import argparse BUFFER_SIZE = 200000 @@ -115,13 +116,12 @@ def interactiveMenu(self, sleep_time): # Creates Interactive menu within the scr if __name__ == "__main__": sleep_time = 1 - file_path = "" - if len(sys.argv) == 2: - file_path = sys.argv[1] - else: - print("Warning - No filepath passed, using default (" + DEFAULT_FP + ").") - file_path = DEFAULT_FP + parser = argparse.ArgumentParser() + parser.add_argument('-s', '--sock_path', default=DEFAULT_FP, + help='Provide socket file path connected by legacy client') + args = parser.parse_args() + client = Client() - client.getFilepath(file_path) + client.getFilepath(args.sock_path) client.register() client.interactiveMenu(sleep_time) -- 2.22.0