winfix and ipython

This commit is contained in:
js0ny 2024-11-13 10:43:39 +00:00
parent 1cc7bae198
commit 908b1fb699
10 changed files with 263 additions and 13 deletions

View 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)