]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/tcsh/svn
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / tcsh / svn
1 #! /usr/bin/env python2.5
2
3 import sys
4 import os
5
6 #for name in os.environ.keys():
7 #       print "key " + name + " = " + os.environ[name]
8
9 def print_output(cmd, prefix):
10         pipeOut = os.popen3(cmd, mode = 'br')[1]
11         for line in pipeOut:
12                 term = ""
13                 if os.path.isdir(line.strip()):
14                         term = "/"
15                 print prefix + line.strip() + term
16         pipeOut.close()
17
18 if not os.environ.has_key("COMMAND_LINE"):
19         print "Fancy completion is not supported by your version of tcsh."
20         sys.exit(1)
21
22 cmdLine = os.environ["COMMAND_LINE"]
23 URL = cmdLine.split()[2]
24 dir = "/" + URL.split('/', 3)[3]
25 prefix = "file:/"
26
27 if dir[-1] != "/":
28         dir = dir.rpartition("/")[0] + "/"
29
30 print_output("svn ls " + "file://" + dir, prefix + "/" + dir)
31 print_output("ls -d /" + dir + "*", prefix)
32