tahoe mkdir
tahoe mkdir [alias:]path
tahoe ls [alias:][path]
-tahoe webopen [alias:]path
+tahoe webopen [alias:][path]
tahoe put [--mutable] [localfrom:-]
tahoe put [--mutable] [localfrom:-] [alias:]to
tahoe put [--mutable] [localfrom:-] [alias:]subdir/to
This lists a subdirectory of your filesystem.
+tahoe webopen
tahoe webopen tahoe:
tahoe webopen tahoe:subdir/
+tahoe webopen subdir/
This uses the python 'webbrowser' module to cause a local web browser to
open to the web page for the given directory. This page offers interfaces to
- add, dowlonad, rename, and delete files in the directory.
+ add, dowlonad, rename, and delete files in the directory. If not given an
+ alias or path, opens "tahoe:", the root dir of the default alias.
tahoe put file.txt
tahoe put ./file.txt
return "%s ln FROM TO" % (os.path.basename(sys.argv[0]),)
class WebopenOptions(VDriveOptions):
- def parseArgs(self, vdrive_pathname=""):
- self['vdrive_pathname'] = vdrive_pathname
+ def parseArgs(self, where=None):
+ self.where = where
+
+ def getSynopsis(self):
+ return "%s webopen [ALIAS:PATH]" % (os.path.basename(sys.argv[0]),)
longdesc = """Opens a webbrowser to the contents of some portion of the virtual drive."""
return rc
def webopen(options, opener=None):
- import urllib, webbrowser
- nodeurl = config['node-url']
- if nodeurl[-1] != "/":
- nodeurl += "/"
- root_cap = config.aliases["tahoe"]
- url = nodeurl + "uri/%s/" % urllib.quote(root_cap)
- if config['vdrive_pathname']:
- url += urllib.quote(config['vdrive_pathname'])
- webbrowser.open(url)
- return 0
+ from allmydata.scripts import tahoe_webopen
+ rc = tahoe_webopen.webopen(options, opener=opener)
+ return rc
dispatch = {
"mkdir": mkdir,
from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path
+import urllib
-def webopen(nodeurl, aliases, where, stdout, stderr):
- import urllib, webbrowser
+def webopen(options, opener=None):
+ nodeurl = options['node-url']
if not nodeurl.endswith("/"):
nodeurl += "/"
- if where.endswith("/"):
- where = where[:-1]
- rootcap, path = get_alias(aliases, where, DEFAULT_ALIAS)
+ where = options.where
+ if where is None:
+ where = 'tahoe:'
+ rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
if path:
- # move where.endswith check here?
url += "/" + escape_path(path)
- webbrowser.open(url)
+ if not opener:
+ import webbrowser
+ opener = webbrowser.open
+ opener(url)
return 0