From: robk-tahoe Date: Thu, 10 Jan 2008 02:19:52 +0000 (-0700) Subject: added a 'repl' command to tahoe.exe X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/something?a=commitdiff_plain;h=08f445a56262cb13fbc527eb4c1981643ed5bbde;p=tahoe-lafs%2Ftahoe-lafs.git added a 'repl' command to tahoe.exe this is probably not of very high utility in the unix case of bin/tahoe but is useful when working with native builds, e.g. py2exe's tahoe.exe, to examine and debug the runtime environment, linking problems etc. --- diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index 0e063377..c8d01eff 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -120,6 +120,9 @@ class WebopenOptions(VDriveOptions): longdesc = """Opens a webbrowser to the contents of some portion of the virtual drive.""" +class ReplOptions(usage.Options): + pass + subCommands = [ ["ls", None, ListOptions, "List a directory"], ["get", None, GetOptions, "Retrieve a file from the virtual drive."], @@ -127,6 +130,7 @@ subCommands = [ ["rm", None, RmOptions, "Unlink a file or directory in the virtual drive."], ["mv", None, MvOptions, "Move a file within the virtual drive."], ["webopen", None, WebopenOptions, "Open a webbrowser to the root_dir"], + ["repl", None, ReplOptions, "Open a python interpreter"], ] def list(config, stdout, stderr): @@ -209,6 +213,10 @@ def webopen(config, stdout, stderr): webbrowser.open(url) return 0 +def repl(config, stdout, stderr): + import code + return code.interact() + dispatch = { "ls": list, "get": get, @@ -216,5 +224,6 @@ dispatch = { "rm": rm, "mv": mv, "webopen": webopen, + "repl": repl, }