mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
winfix and ipython
This commit is contained in:
parent
1cc7bae198
commit
908b1fb699
10 changed files with 263 additions and 13 deletions
10
.config/ipython/profile_default/starup/magic_ps.py
Normal file
10
.config/ipython/profile_default/starup/magic_ps.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from IPython.core.magic import register_line_magic
|
||||
|
||||
@register_line_magic
|
||||
def ps(cmd):
|
||||
output = get_ipython().getoutput(f"powershell -Command {cmd}")
|
||||
# If no variable is assigned to the output, print it
|
||||
if get_ipython().last_execution_result is None:
|
||||
print("\n".join(output))
|
||||
else:
|
||||
return "\n".join(output)
|
||||
Loading…
Add table
Add a link
Reference in a new issue