##// END OF EJS Templates
`%alias_magic` print a message for each new alias.
Bradley M. Froehle -
Show More
@@ -65,6 +65,8 b' class BasicMagics(Magics):'
65 --------
65 --------
66 ::
66 ::
67 In [1]: %alias_magic t timeit
67 In [1]: %alias_magic t timeit
68 Created `%t` as an alias for `%timeit`.
69 Created `%%t` as an alias for `%%timeit`.
68
70
69 In [2]: %t -n1 pass
71 In [2]: %t -n1 pass
70 1 loops, best of 3: 954 ns per loop
72 1 loops, best of 3: 954 ns per loop
@@ -77,6 +79,7 b' class BasicMagics(Magics):'
77 In [4]: %alias_magic --cell whereami pwd
79 In [4]: %alias_magic --cell whereami pwd
78 UsageError: Cell magic function `%%pwd` not found.
80 UsageError: Cell magic function `%%pwd` not found.
79 In [5]: %alias_magic --line whereami pwd
81 In [5]: %alias_magic --line whereami pwd
82 Created `%whereami` as an alias for `%pwd`.
80
83
81 In [6]: %whereami
84 In [6]: %whereami
82 Out[6]: u'/home/testuser'
85 Out[6]: u'/home/testuser'
@@ -111,9 +114,15 b' class BasicMagics(Magics):'
111
114
112 if args.line:
115 if args.line:
113 mman.register_alias(name, target, 'line')
116 mman.register_alias(name, target, 'line')
117 print('Created `%s%s` as an alias for `%s%s`.' % (
118 magic_escapes['line'], name,
119 magic_escapes['line'], target))
114
120
115 if args.cell:
121 if args.cell:
116 mman.register_alias(name, target, 'cell')
122 mman.register_alias(name, target, 'cell')
123 print('Created `%s%s` as an alias for `%s%s`.' % (
124 magic_escapes['cell'], name,
125 magic_escapes['cell'], target))
117
126
118 def _lsmagic(self):
127 def _lsmagic(self):
119 mesc = magic_escapes['line']
128 mesc = magic_escapes['line']
General Comments 0
You need to be logged in to leave comments. Login now