Rev 559 | Rev 561 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 559 | Rev 560 | ||
---|---|---|---|
Line 307... | Line 307... | ||
307 | args = res.group(2).strip().split(' ') |
307 | args = res.group(2).strip().split(' ') |
308 | cmd = args[0].lower() |
308 | cmd = args[0].lower() |
309 | args = args[1:] |
309 | args = args[1:] |
310 | if cmd == 'saveas': |
310 | if cmd == 'saveas': |
311 | outf.write('%s = %s\n' % (args[1],defaults[args[0]])) |
311 | outf.write('%s = %s\n' % (args[1],defaults[args[0]])) |
- | 312 | elif cmd == 'shellcmd': |
|
- | 313 | varname = args[0] |
|
312 | 314 | args = args[1:] |
|
- | 315 | for i,arg in enumerate(args): |
|
- | 316 | if arg.startswith('$'): |
|
- | 317 | args[i] = defaults[arg[1:]] |
|
- | 318 | ||
- | 319 | subc = os.popen(' '.join(args),'r') |
|
- | 320 | data = subc.read().strip() |
|
- | 321 | if subc.close(): |
|
- | 322 | raise RuntimeError('Error running: %s' % ' '.join(args)) |
|
- | 323 | outf.write('%s = %s\n' % (varname,data)) |
|
313 | continue |
324 | continue |
314 | 325 | ||
315 | if line.startswith('!'): |
326 | if line.startswith('!'): |
316 | # Ask a question |
327 | # Ask a question |
317 | res = re.search(r'!\s*(?:\[(.*?)\])?\s*([^\s]+)\s*\((.*)\)\s*$', line) |
328 | res = re.search(r'!\s*(?:\[(.*?)\])?\s*([^\s]+)\s*\((.*)\)\s*$', line) |