1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-22 12:58:33 +00:00

Merge pull request #608 from MattKotsenas/bugfix/no-history

Update PowerShell alias to handle no history
This commit is contained in:
Vladimir Iakovlev 2017-03-03 13:45:23 +01:00 committed by GitHub
commit 20246e5be6

View File

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