Show More
@@ -32,7 +32,7 b" ip.set_hook('editor', calljed)" | |||
|
32 | 32 | You can then enable the functionality by doing 'import myiphooks' |
|
33 | 33 | somewhere in your configuration files or ipython command line. |
|
34 | 34 | |
|
35 |
$Id: hooks.py 2 |
|
|
35 | $Id: hooks.py 2951 2008-01-19 11:32:18Z vivainio $""" | |
|
36 | 36 | |
|
37 | 37 | #***************************************************************************** |
|
38 | 38 | # Copyright (C) 2005 Fernando Perez. <fperez@colorado.edu> |
@@ -48,14 +48,14 b' __license__ = Release.license' | |||
|
48 | 48 | __version__ = Release.version |
|
49 | 49 | |
|
50 | 50 | import os,bisect |
|
51 | from genutils import Term | |
|
51 | from genutils import Term,shell | |
|
52 | 52 | from pprint import PrettyPrinter |
|
53 | 53 | |
|
54 | 54 | # List here all the default hooks. For now it's just the editor functions |
|
55 | 55 | # but over time we'll move here all the public API for user-accessible things. |
|
56 | 56 | __all__ = ['editor', 'fix_error_editor', 'result_display', |
|
57 | 57 | 'input_prefilter', 'shutdown_hook', 'late_startup_hook', |
|
58 |
'generate_prompt', 'generate_output_prompt' |
|
|
58 | 'generate_prompt', 'generate_output_prompt','shell_hook'] | |
|
59 | 59 | |
|
60 | 60 | pformat = PrettyPrinter().pformat |
|
61 | 61 | |
@@ -213,3 +213,9 b' def generate_prompt(self, is_continuation):' | |||
|
213 | 213 | def generate_output_prompt(self): |
|
214 | 214 | ip = self.api |
|
215 | 215 | return str(ip.IP.outputcache.prompt_out) |
|
216 | ||
|
217 | def shell_hook(self,cmd): | |
|
218 | """ Run system/shell command a'la os.system() """ | |
|
219 | ||
|
220 | shell(cmd, header=self.rc.system_header, verbose=self.rc.system_verbose) | |
|
221 |
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.' | |||
|
6 | 6 | |
|
7 | 7 | This file contains all the classes and helper functions specific to IPython. |
|
8 | 8 | |
|
9 |
$Id: iplib.py 29 |
|
|
9 | $Id: iplib.py 2951 2008-01-19 11:32:18Z vivainio $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
@@ -490,9 +490,7 b' class InteractiveShell(object,Magic):' | |||
|
490 | 490 | # The first is similar to os.system, but it doesn't return a value, |
|
491 | 491 | # and it allows interpolation of variables in the user's namespace. |
|
492 | 492 | self.system = lambda cmd: \ |
|
493 |
shell(self.var_expand(cmd,depth=2) |
|
|
494 | header=self.rc.system_header, | |
|
495 | verbose=self.rc.system_verbose) | |
|
493 | self.hooks.shell_hook(self.var_expand(cmd,depth=2)) | |
|
496 | 494 | |
|
497 | 495 | # These are for getoutput and getoutputerror: |
|
498 | 496 | self.getoutput = lambda cmd: \ |
General Comments 0
You need to be logged in to leave comments.
Login now