No longer needed.
[0publish.git] / 0publish
blob04510c6324477720df50b8b8683ee02027b1e264
1 #!/usr/bin/env python
2 from optparse import OptionParser
3 import os, sys
5 version = '0.1'
7 parser = OptionParser(usage="usage: %prog [options] interface")
8 parser.add_option("-V", "--version", help="display version information", action='store_true')
10 (options, args) = parser.parse_args()
12 if options.version:
13 print "0publish (zero-install) " + version
14 print "Copyright (C) 2005 Thomas Leonard"
15 print "This program comes with ABSOLUTELY NO WARRANTY,"
16 print "to the extent permitted by law."
17 print "You may redistribute copies of this program"
18 print "under the terms of the GNU General Public License."
19 print "For more information about these matters, see the file named COPYING."
20 sys.exit(0)
22 if len(args) != 1:
23 parser.print_help()
24 sys.exit(1)
25 interface = args[0]
27 def confirm(q):
28 while True:
29 ans = raw_input(q + " [Y/N] ").lower()
30 if ans in ('y', 'yes'): return True
31 if ans in ('n', 'no'): return False
33 if os.path.exists(interface):
34 from update import update
35 update(interface)
36 else:
37 if confirm("Interface file '%s' does not exist. Create it?" % interface):
38 from create import create
39 create(interface)