-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1329: Add support for Windows
CMD
and easier setup for Powershell
* feat: Added nicer support for Windows CMD & Powershell * Fix typo * Fix CMD console color after thefuck Ctrl-C * Update setup.py Co-authored-by: Pablo Aguiar <scorphus@gmail.com> * Update setup.py Co-authored-by: Pablo Aguiar <scorphus@gmail.com> * Addressed PR comments * fix spacing and newline issues --------- Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
- Loading branch information
Showing
3 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@set PYTHONIOENCODING=utf-8 | ||
@powershell -noprofile -c "cmd /c \"$(thefuck %* $(doskey /history)[-2])\"; [Console]::ResetColor();" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
if ((Get-Command "fuck").CommandType -eq "Function") { | ||
fuck @args; | ||
[Console]::ResetColor() | ||
exit | ||
} | ||
|
||
"First time use of thefuck detected. " | ||
|
||
if ((Get-Content $PROFILE -Raw -ErrorAction Ignore) -like "*thefuck*") { | ||
} else { | ||
" - Adding thefuck intialization to user `$PROFILE" | ||
$script = "`n`$env:PYTHONIOENCODING='utf-8' `niex `"`$(thefuck --alias)`""; | ||
Write-Output $script | Add-Content $PROFILE | ||
} | ||
|
||
" - Adding fuck() function to current session..." | ||
$env:PYTHONIOENCODING='utf-8' | ||
iex "$($(thefuck --alias).Replace("function fuck", "function global:fuck"))" | ||
|
||
" - Invoking fuck()`n" | ||
fuck @args; | ||
[Console]::ResetColor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters