mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-25 07:31:07 +00:00
added "tahoe webopen" command
taking the same arguments as tahoe ls, it does a webbrowser.open to the page specified by those args. hence "tahoe webopen" will open a browser to the root dir specified in private/root_dir.cap by default. this might be a good alternative to the start.html page.
This commit is contained in:
parent
654d32b34a
commit
6fa70befd5
@ -114,6 +114,11 @@ class MvOptions(VDriveOptions):
|
|||||||
def getSynopsis(self):
|
def getSynopsis(self):
|
||||||
return "%s mv FROM TO" % (os.path.basename(sys.argv[0]),)
|
return "%s mv FROM TO" % (os.path.basename(sys.argv[0]),)
|
||||||
|
|
||||||
|
class WebopenOptions(VDriveOptions):
|
||||||
|
def parseArgs(self, vdrive_pathname=""):
|
||||||
|
self['vdrive_pathname'] = vdrive_pathname
|
||||||
|
|
||||||
|
longdesc = """Opens a webbrowser to the contents of some portion of the virtual drive."""
|
||||||
|
|
||||||
subCommands = [
|
subCommands = [
|
||||||
["ls", None, ListOptions, "List a directory"],
|
["ls", None, ListOptions, "List a directory"],
|
||||||
@ -121,6 +126,7 @@ subCommands = [
|
|||||||
["put", None, PutOptions, "Upload a file into the virtual drive."],
|
["put", None, PutOptions, "Upload a file into the virtual drive."],
|
||||||
["rm", None, RmOptions, "Unlink a file or directory in the virtual drive."],
|
["rm", None, RmOptions, "Unlink a file or directory in the virtual drive."],
|
||||||
["mv", None, MvOptions, "Move a file within the virtual drive."],
|
["mv", None, MvOptions, "Move a file within the virtual drive."],
|
||||||
|
["webopen", None, WebopenOptions, "Open a webbrowser to the root_dir"],
|
||||||
]
|
]
|
||||||
|
|
||||||
def list(config, stdout, stderr):
|
def list(config, stdout, stderr):
|
||||||
@ -192,11 +198,23 @@ def mv(config, stdout, stderr):
|
|||||||
stdout, stderr)
|
stdout, stderr)
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
|
def webopen(config, stdout, stderr):
|
||||||
|
import urllib, webbrowser
|
||||||
|
nodeurl = config['node-url']
|
||||||
|
if nodeurl[-1] != "/":
|
||||||
|
nodeurl += "/"
|
||||||
|
url = nodeurl + "uri/%s/" % urllib.quote(config['dir-uri'])
|
||||||
|
if config['vdrive_pathname']:
|
||||||
|
url += urllib.quote(config['vdrive_pathname'])
|
||||||
|
webbrowser.open(url)
|
||||||
|
return 0
|
||||||
|
|
||||||
dispatch = {
|
dispatch = {
|
||||||
"ls": list,
|
"ls": list,
|
||||||
"get": get,
|
"get": get,
|
||||||
"put": put,
|
"put": put,
|
||||||
"rm": rm,
|
"rm": rm,
|
||||||
"mv": mv,
|
"mv": mv,
|
||||||
|
"webopen": webopen,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user