1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 10:51:11 +01:00

Add semi-colons in powershell alias

Add semi-colons in powershell alias so that if line breaks get lost the
function can still be invoked directly. This makes it possible to add
thefuck to the current session by running

    iex "$(thefuck --alias)"

which mirrors the eval syntax in bash
This commit is contained in:
Matt Kotsenas 2016-06-27 13:29:24 -04:00
parent 42853f41bb
commit 16c110823d

View File

@ -4,10 +4,10 @@ from .generic import Generic
class Powershell(Generic):
def app_alias(self, fuck):
return 'function ' + fuck + ' { \n' \
' $fuck = $(thefuck (Get-History -Count 1).CommandLine)\n' \
' $fuck = $(thefuck (Get-History -Count 1).CommandLine);\n' \
' if (-not [string]::IsNullOrWhiteSpace($fuck)) {\n' \
' if ($fuck.StartsWith("echo")) { $fuck = $fuck.Substring(5) }\n' \
' else { iex "$fuck" }\n' \
' if ($fuck.StartsWith("echo")) { $fuck = $fuck.Substring(5); }\n' \
' else { iex "$fuck"; }\n' \
' }\n' \
'}\n'