From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Tue, 10 Jul 2007 01:20:02 +0000 (-0700)
Subject: tahoe-get.py: accept vdrive and server options (using optparse)
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri//%22?a=commitdiff_plain;h=9641a6df227cb3be5fed4998f453afbc046fb669;p=tahoe-lafs%2Ftahoe-lafs.git

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

diff --git a/src/allmydata/scripts/tahoe-get.py b/src/allmydata/scripts/tahoe-get.py
index 4a034d5a..5c92ef0e 100644
--- a/src/allmydata/scripts/tahoe-get.py
+++ b/src/allmydata/scripts/tahoe-get.py
@@ -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)