From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E2776A04F7 for ; Fri, 20 Dec 2019 08:41:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CBF832BF9; Fri, 20 Dec 2019 08:41:13 +0100 (CET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by dpdk.org (Postfix) with ESMTP id E4BE6330 for ; Fri, 20 Dec 2019 08:41:11 +0100 (CET) Received: by mail-pf1-f175.google.com with SMTP id l127so4748879pfl.1 for ; Thu, 19 Dec 2019 23:41:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=/pyxrby+BRVOGE8ER8UPO92xR4Rpd85FOoFpbKypZAw=; b=cWuiTn3Uss6TM3/m/gXjIOLEKU0UzytaScTKiFMsmfNENVH19oYifOak+eTU1OWCe+ kqU7y7JXjhFvACmW+nq5yLtKR5kd2yOc9EaFTbrKMQ4rz1/MMGtVKiq4VX+Zv1RbBjpk zGeTfnrIb+UWDXy0s7C+RmyLvY0NKl8at7BY6gFhqBCIKy8Ift1yF54RFADRnGwGK+iW lblehioskOENQ4MhJR3H/i7JWW5xAxQnr27T9hEgqLJHq0uEuuSFxLkH8Dp3fK4xSEpo GhFcHhuZLv14it1ulvGHR3JlWnSvQyk6v46ecTYNu7lIaa/on0j0HMylqByQUXwJzgjW mgtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=/pyxrby+BRVOGE8ER8UPO92xR4Rpd85FOoFpbKypZAw=; b=jcHGjqOQhv1LaIXxGsfm9FmC2zvabu6MFzAxmrM75u95+xuwIsu3byrcexkuTbW3Od 6i1BtTtAAr0/OhsA5mzalNXcvXsjMJU8vmro1s6qiwPO/J5Z8RglXcWgSJ0B8pspYjkL yUCxXAXfkO8Lw+lKA2paoHR+dNy73eWJkVuZW8DRQaY1KQHwUPVjHelkjYlXN13b+l+J lvii5bNGdq7Li5k7BsILwR6tT3fLjoU3bi9/czb17oJwVFCa5poZ3re5/SATHJN76z1F vDqsewgcb0MNpEeGeA5L+Pl9pV/nW1xggkAGeXTG/jvf1O2vcNU9nWYEKJcU8k1CJKgJ nwng== X-Gm-Message-State: APjAAAXh+lnS9PziEW/f40cs/+GJ+yW9JIcb6qX8nVc2sIoGuH8dYfpd yeHgAFS23JBtoBt8FfFq1p+BQR/m X-Google-Smtp-Source: APXvYqyDJhaDI5fS1B6UHod+xVtuiXJkIa4R9Yz1jSsvQQrS/Gme7SxsvB9lPh/JBaGbTulDDX/W6g== X-Received: by 2002:a63:534d:: with SMTP id t13mr12908720pgl.89.1576827670970; Thu, 19 Dec 2019 23:41:10 -0800 (PST) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id i3sm9641378pfo.72.2019.12.19.23.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 23:41:10 -0800 (PST) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Fri, 20 Dec 2019 16:40:58 +0900 Message-Id: <20191220074103.14065-2-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220074103.14065-1-yasufum.o@gmail.com> References: <20191220074103.14065-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 1/6] cli: add env command X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa Add `env` command for displaying environmental variables. It displays env variables starts with given keyword, or all variables if it is not given. It is mainly used for finding variables related to SPP. # show variables starts with `SPP` spp > env SPP SPP_CTL_IP: 127.0.0.1 SPP_FILE_PREFIX: spp Signed-off-by: Yasufumi Ogawa --- src/cli/commands/help_msg.py | 10 ++++++++++ src/cli/shell.py | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/cli/commands/help_msg.py b/src/cli/commands/help_msg.py index f303547..4cf2a1f 100644 --- a/src/cli/commands/help_msg.py +++ b/src/cli/commands/help_msg.py @@ -8,6 +8,16 @@ cmds = { spp > status """, + 'env': + """Show environmental variables. + + # show all env varibles. + spp > env + + # show env varibles starts with `SPP`. + spp > env SPP + """, + 'record': """Save commands as a recipe file. diff --git a/src/cli/shell.py b/src/cli/shell.py index 0de6176..cfc343c 100644 --- a/src/cli/shell.py +++ b/src/cli/shell.py @@ -317,6 +317,17 @@ class Shell(cmd.Cmd, object): """Print help message of status command.""" print(help_msg.cmds['status']) + def do_env(self, key): + """Display environmental variables.""" + + for k, v in sorted(os.environ.items()): + if k.startswith(key): + print("{}: {}".format(k, v)) + + def help_env(self): + """Print help message of env command.""" + print(help_msg.cmds['env']) + def do_pri(self, command): """Send a command to primary process.""" -- 2.17.1