tahoe-get.py: accept vdrive and server options (using optparse)

This commit is contained in:
Zooko O'Whielacronx 2007-07-09 18:20:02 -07:00
parent 8769f2eeba
commit 9641a6df22

View File

@ -1,15 +1,24 @@
#!/usr/bin/env python
import sys, urllib
import optparse, sys, urllib
def GET(url):
f = urllib.urlopen(url)
sys.stdout.write(f.read())
vfname = sys.argv[1]
parser = optparse.OptionParser()
parser.add_option("-d", "--vdrive", dest="vdrive", default="global")
parser.add_option("-s", "--server", dest="server", default="http://tahoebs1.allmydata.com:8011")
(options, args) = parser.parse_args()
vfname = args[0]
base = "http://tahoebs1.allmydata.com:8011/"
base += "vdrive/global/"
base += "vdrive/"
base += options.vdrive
base += "/"
url = base + vfname
GET(url)