mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 03:56:01 +00:00
#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>
This commit is contained in:
parent
0420442e77
commit
3cd187a3bb
2
scripts/fuck.bat
Normal file
2
scripts/fuck.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@set PYTHONIOENCODING=utf-8
|
||||
@powershell -noprofile -c "cmd /c \"$(thefuck %* $(doskey /history)[-2])\"; [Console]::ResetColor();"
|
22
scripts/fuck.ps1
Normal file
22
scripts/fuck.ps1
Normal file
@ -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()
|
16
setup.py
16
setup.py
@ -40,6 +40,17 @@ extras_require = {':python_version<"3.4"': ['pathlib2'],
|
||||
':python_version>"2.7"': ['decorator', 'pyte'],
|
||||
":sys_platform=='win32'": ['win_unicode_console']}
|
||||
|
||||
if sys.platform == "win32":
|
||||
scripts = ['scripts\\fuck.bat', 'scripts\\fuck.ps1']
|
||||
entry_points = {'console_scripts': [
|
||||
'thefuck = thefuck.entrypoints.main:main',
|
||||
'thefuck_firstuse = thefuck.entrypoints.not_configured:main']}
|
||||
else:
|
||||
scripts = []
|
||||
entry_points = {'console_scripts': [
|
||||
'thefuck = thefuck.entrypoints.main:main',
|
||||
'fuck = thefuck.entrypoints.not_configured:main']}
|
||||
|
||||
setup(name='thefuck',
|
||||
version=VERSION,
|
||||
description="Magnificent app which corrects your previous console command",
|
||||
@ -55,6 +66,5 @@ setup(name='thefuck',
|
||||
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
|
||||
install_requires=install_requires,
|
||||
extras_require=extras_require,
|
||||
entry_points={'console_scripts': [
|
||||
'thefuck = thefuck.entrypoints.main:main',
|
||||
'fuck = thefuck.entrypoints.not_configured:main']})
|
||||
scripts=scripts,
|
||||
entry_points=entry_points)
|
||||
|
Loading…
Reference in New Issue
Block a user