From 033b7b64757f6e5846160185c752356e7efeafa4 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Wed, 25 Jul 2007 09:44:39 +0000 Subject: [PATCH] =?utf8?q?Implement=20=E2=80=9Ccd=20/=E2=80=9D=20and=20=E2=80?= =?utf8?q?=9Ccd=E2=80=9D=20to=20get=20to=20the=20root=20directory.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: iustinp --- tools/cfgshell | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/cfgshell b/tools/cfgshell index 253d32a..966cc99 100755 --- a/tools/cfgshell +++ b/tools/cfgshell @@ -186,7 +186,8 @@ class ConfigShell(cmd.Cmd): def do_cd(self, line): """Changes the current path. - Valid arguments: either .. or a child of the current object. + Valid arguments: either .., /, "" (no argument) or a child of the current + object. """ if line == "..": @@ -197,6 +198,10 @@ class ConfigShell(cmd.Cmd): else: print "Already at top level" return False + elif len(line) == 0 or line == "/": + self.parents = self.parents[0:1] + self.path = [] + return False pointer = self.parents[-1] dirs, entries = self._get_entries(pointer) @@ -317,6 +322,7 @@ class ConfigShell(cmd.Cmd): print return True + class Error(Exception): """Generic exception""" pass -- 1.7.10.4