1 |
douglas |
587 |
#!/usr/bin/env python |
2 |
|
|
# CCS Computer Science |
3 |
|
|
# Change Shell |
4 |
|
|
# |
5 |
|
|
# Douglas Thrift |
6 |
|
|
# |
7 |
|
|
# $Id$ |
8 |
|
|
|
9 |
douglas |
590 |
import common |
10 |
douglas |
587 |
import re |
11 |
|
|
|
12 |
|
|
if __name__ == '__main__': |
13 |
|
|
try: |
14 |
douglas |
590 |
shells = map(lambda shells: shells[0], common.SHELLS) |
15 |
douglas |
587 |
shell = None |
16 |
|
|
|
17 |
|
|
while shell not in shells: |
18 |
|
|
shell = raw_input('Shell (%s): ' % ', '.join(shells)) |
19 |
|
|
|
20 |
douglas |
590 |
shells = dict(common.SHELLS)[shell] |
21 |
douglas |
587 |
|
22 |
|
|
if shell == 'custom': |
23 |
|
|
path = re.compile('^/.*[^/]$') |
24 |
|
|
|
25 |
douglas |
590 |
for system in common.SYSTEMS: |
26 |
douglas |
587 |
while shells[system] is None or path.match(shells[system]) is None: |
27 |
|
|
shells[system] = raw_input((system.capitalize() if not system.endswith('bsd') else system[:-3].capitalize() + 'BSD') + ': ') |
28 |
|
|
except (EOFError, KeyboardInterrupt): |
29 |
|
|
pass |