|
1 | 1 | #! /usr/bin/python |
2 | | -# $Id: roundup-admin,v 1.6 2001-07-30 00:57:51 richard Exp $ |
| 2 | +# $Id: roundup-admin,v 1.7 2001-07-30 01:28:46 richard Exp $ |
3 | 3 |
|
4 | 4 | import sys |
5 | 5 | if int(sys.version[0]) < 2: |
@@ -92,31 +92,28 @@ def do_init(instance_home, args): |
92 | 92 | through INSTANCE_HOME or the -i option. The template, backend and admin |
93 | 93 | password may be specified on the command-line as arguments, in that order. |
94 | 94 | ''' |
95 | | - if len(argv) > n: |
96 | | - template = argv[n] |
97 | | - backend = argv[n+1] |
98 | | - else: |
99 | | - template = backend = '' |
100 | | - |
101 | 95 | # select template |
102 | 96 | import roundup.templates |
103 | 97 | templates = roundup.templates.listTemplates() |
104 | | - print 'Templates:', ', '.join(templates) |
105 | | - template = len(args) and args[0] or '' |
| 98 | + template = len(args) > 1 and args[1] or '' |
| 99 | + if template not in templates: |
| 100 | + print 'Templates:', ', '.join(templates) |
106 | 101 | while template not in templates: |
107 | 102 | template = raw_input('Select template [classic]: ').strip() |
108 | 103 | if not template: |
109 | 104 | template = 'classic' |
110 | 105 |
|
111 | 106 | import roundup.backends |
112 | 107 | backends = roundup.backends.__all__ |
113 | | - backend = len(args) > 1 and args[1] or '' |
| 108 | + backend = len(args) > 2 and args[2] or '' |
| 109 | + if backend not in backends: |
| 110 | + print 'Back ends:', ', '.join(backends) |
114 | 111 | while backend not in backends: |
115 | 112 | backend = raw_input('Select backend [anydbm]: ').strip() |
116 | 113 | if not backend: |
117 | 114 | backend = 'anydbm' |
118 | | - if len(args) > 2: |
119 | | - adminpw = confirm = args[2] |
| 115 | + if len(args) > 3: |
| 116 | + adminpw = confirm = args[3] |
120 | 117 | else: |
121 | 118 | adminpw = '' |
122 | 119 | confirm = 'x' |
@@ -392,6 +389,10 @@ if __name__ == '__main__': |
392 | 389 |
|
393 | 390 | # |
394 | 391 | # $Log: not supported by cvs2svn $ |
| 392 | +# Revision 1.6 2001/07/30 00:57:51 richard |
| 393 | +# Now uses getopt, much improved command-line parsing. Much fuller help. Much |
| 394 | +# better internal structure. It's just BETTER. :) |
| 395 | +# |
395 | 396 | # Revision 1.5 2001/07/30 00:04:48 richard |
396 | 397 | # Made the "init" prompting more friendly. |
397 | 398 | # |
|
0 commit comments