From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mogw1140.ocn.ad.jp (mogw1140.ocn.ad.jp [153.149.229.41]) by dpdk.org (Postfix) with ESMTP id 6A9892BF2 for ; Tue, 6 Mar 2018 11:51:32 +0100 (CET) Received: from mf-smf-ucb034c2 (mf-smf-ucb034c2.ocn.ad.jp [153.153.66.228]) by mogw1140.ocn.ad.jp (Postfix) with ESMTP id D9F52880470; Tue, 6 Mar 2018 19:51:30 +0900 (JST) Received: from ntt.pod01.mv-mta-ucb024 ([153.149.142.98]) by mf-smf-ucb034c2 with ESMTP id tABue7pHF3uoqtABue6x1h; Tue, 06 Mar 2018 19:51:30 +0900 Received: from smtp.ocn.ne.jp ([153.149.227.165]) by ntt.pod01.mv-mta-ucb024 with id JarW1x0063akymp01arWBg; Tue, 06 Mar 2018 10:51:30 +0000 Received: from localhost.localdomain (sp1-66-103-93.msc.spmode.ne.jp [1.66.103.93]) by smtp.ocn.ne.jp (Postfix) with ESMTPA; Tue, 6 Mar 2018 19:51:30 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: ferruh.yigit@intel.com, spp@dpdk.org Cc: Yasufumi Ogawa Date: Tue, 6 Mar 2018 19:50:54 +0900 Message-Id: <20180306105055.65210-13-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20180306105055.65210-1-ogawa.yasufumi@lab.ntt.co.jp> References: <20180306105055.65210-1-ogawa.yasufumi@lab.ntt.co.jp> Subject: [spp] [PATCH 12/13] controller: add cat and less 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: , X-List-Received-Date: Tue, 06 Mar 2018 10:51:32 -0000 From: Yasufumi Ogawa Signed-off-by: Yasufumi Ogawa --- src/controller/shell.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/controller/shell.py b/src/controller/shell.py index 8aae86d..86598d3 100644 --- a/src/controller/shell.py +++ b/src/controller/shell.py @@ -468,6 +468,34 @@ class Shell(cmd.Cmd, object): ] return completions + def do_cat(self, arg): + """View contents of a file + + spp > cat file + """ + if os.path.isfile(arg): + c = 'cat %s' % arg + subprocess.call(c, shell=True) + else: + print("No such a directory.") + + def complete_cat(self, text, line, begidx, endidx): + return common.compl_common(text, line) + + def do_less(self, arg): + """View contents of a file + + spp > less file + """ + if os.path.isfile(arg): + c = 'less %s' % arg + subprocess.call(c, shell=True) + else: + print("No such a directory.") + + def complete_less(self, text, line, begidx, endidx): + return common.compl_common(text, line) + def do_exit(self, args): """Terminate SPP controller -- 2.13.1