Soft Patch Panel
 help / color / Atom feed
From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 09/10] controller: move status cmd help msg to help_msg
Date: Mon, 24 Jun 2019 16:11:23 +0900
Message-ID: <20190624071124.23451-10-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190624071124.23451-1-yasufum.o@gmail.com>

From: Yasufumi Ogawa <yasufum.o@gmail.com>

This update is to move help message of status command to `help_msg`
module which is for defining a set of command name and message.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/controller/commands/help_msg.py | 10 ++++++++++
 src/controller/shell.py             | 15 ++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)
 create mode 100644 src/controller/commands/help_msg.py

diff --git a/src/controller/commands/help_msg.py b/src/controller/commands/help_msg.py
new file mode 100644
index 0000000..9e15123
--- /dev/null
+++ b/src/controller/commands/help_msg.py
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
+
+commands = {
+        'status':
+        """Display status info of SPP processes.
+
+        spp > status
+        """
+        }
diff --git a/src/controller/shell.py b/src/controller/shell.py
index 54376c9..065fb07 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -10,6 +10,7 @@ from .commands import topo
 from .commands import vf
 from .commands import mirror
 from .commands import pcap
+from .commands import help_msg
 import os
 import re
 import readline
@@ -29,7 +30,7 @@ class Shell(cmd.Cmd, object):
         config_file = "{}/config/default.yml".format(
                 os.path.dirname(__file__))
         cli_config = yaml.load(open(config_file),
-                Loader=yaml.FullLoader)
+                               Loader=yaml.FullLoader)
     except IOError as e:
         print('Error: no config file found!')
         print(e)
@@ -205,7 +206,7 @@ class Shell(cmd.Cmd, object):
                 pt2 = id2.split(delim)[0]
                 if (pt1 in spp_common.PORT_TYPES) \
                         and (pt2 in spp_common.PORT_TYPES):
-                            return True
+                    return True
         return False
 
     def clean_cmd(self, cmdstr):
@@ -270,13 +271,13 @@ class Shell(cmd.Cmd, object):
         return res
 
     def do_status(self, _):
-        """Display status info of SPP processes
-
-        spp > status
-        """
-
+        """Display status info of SPP processes."""
         self.print_status()
 
+    def help_status(self):
+        """Print help message of status command."""
+        print(help_msg.commads['status'])
+
     def do_pri(self, command):
         """Send a command to primary process."""
 
-- 
2.17.1


  parent reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24  7:11 [spp] [PATCH 00/10] Move help messages of CLI in shell.py yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 01/10] controller: move vf help msg to SppVf.help yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 02/10] controller: move server help msg to SppCtlServer yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 03/10] controller: move pri help msg to SppPrimary yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 04/10] controller: move nfv help msg to SppNfv yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 05/10] controller: move mirror help msg to SppMirror yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 06/10] controller: move pcap help msg to SppPcap yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 07/10] controller: move bye help msg to SppBye yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 08/10] controller: move topo " yasufum.o
2019-06-24  7:11 ` yasufum.o [this message]
2019-06-24  7:11 ` [spp] [PATCH 10/10] controller: move rest of help msg to help_msg yasufum.o

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190624071124.23451-10-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox