From: Brian Warner Date: Tue, 12 Aug 2008 20:40:17 +0000 (-0700) Subject: CLI: move the 'repl' command to 'tahoe debug repl' X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/readonly?a=commitdiff_plain;h=1711b5591f119547874c963c8d54651c8e0df53a;p=tahoe-lafs%2Ftahoe-lafs.git CLI: move the 'repl' command to 'tahoe debug repl' --- diff --git a/docs/CLI.txt b/docs/CLI.txt index 73679e01..d2e6ede6 100644 --- a/docs/CLI.txt +++ b/docs/CLI.txt @@ -352,7 +352,7 @@ aspect of this command is to reveal the storage index for any given URI. This can be used to locate the share files that are holding the encoded+encrypted data for this file. -"tahoe repl" will launch an interactive python interpreter in which the Tahoe -packages and modules are available on sys.path (e.g. by using 'import +"tahoe debug repl" will launch an interactive python interpreter in which the +Tahoe packages and modules are available on sys.path (e.g. by using 'import allmydata'). This is most useful from a source tree: it simply sets the PYTHONPATH correctly and runs the 'python' executable. diff --git a/src/allmydata/scripts/cli.py b/src/allmydata/scripts/cli.py index 183421a5..2de968bd 100644 --- a/src/allmydata/scripts/cli.py +++ b/src/allmydata/scripts/cli.py @@ -194,9 +194,6 @@ class WebopenOptions(VDriveOptions): longdesc = """Opens a webbrowser to the contents of some portion of the virtual drive.""" -class ReplOptions(usage.Options): - pass - subCommands = [ ["mkdir", None, MakeDirectoryOptions, "Create a new directory"], ["add-alias", None, AddAliasOptions, "Add a new alias cap"], @@ -210,7 +207,6 @@ subCommands = [ ["mv", None, MvOptions, "Move a file within the virtual drive."], ["ln", None, LnOptions, "Make an additional link to an existing file."], ["webopen", None, WebopenOptions, "Open a webbrowser to the root_dir"], - ["repl", None, ReplOptions, "Open a python interpreter"], ] def mkdir(options): @@ -297,10 +293,6 @@ def webopen(options, opener=None): opener(url) return 0 -def repl(options): - import code - return code.interact() - dispatch = { "mkdir": mkdir, "add-alias": add_alias, @@ -314,6 +306,5 @@ dispatch = { "mv": mv, "ln": ln, "webopen": webopen, - "repl": repl, } diff --git a/src/allmydata/scripts/debug.py b/src/allmydata/scripts/debug.py index 08e4f42e..6c604fe8 100644 --- a/src/allmydata/scripts/debug.py +++ b/src/allmydata/scripts/debug.py @@ -562,6 +562,14 @@ def catalog_shares(config, out=sys.stdout, err=sys.stderr): return 0 +class ReplOptions(usage.Options): + pass + +def repl(options, out=sys.stdout, err=sys.stderr): + import code + return code.interact() + + class DebugCommand(usage.Options): subCommands = [ ["dump-share", None, DumpOptions, @@ -569,6 +577,7 @@ class DebugCommand(usage.Options): ["dump-cap", None, DumpCapOptions, "Unpack a read-cap or write-cap"], ["find-shares", None, FindSharesOptions, "Locate sharefiles in node dirs"], ["catalog-shares", None, CatalogSharesOptions, "Describe shares in node dirs"], + ["repl", None, ReplOptions, "Open a python interpreter"], ] def postOptions(self): if not hasattr(self, 'subOptions'): @@ -594,6 +603,7 @@ subDispatch = { "dump-cap": dump_cap, "find-shares": find_shares, "catalog-shares": catalog_shares, + "repl": repl, }