Fix it is a little pet project that corrects simple errors we do sometimes in console commands.
It is a sameless copy of the amazing project TheFuck, but written in c# and made for Windows.
C:\dev\fix>git statu
git: 'statu' is not a git command. See 'git --help'.
The most similar commands are
status
stage
stash
C:\dev\fix>fix
C:\dev\fix>git status
On branch main
Your branch is up to date with 'origin/main'.
...
C:\dev\fix>git push
fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin main
C:\dev\fix>fix
C:\dev\fix>git push --set-upstream origin main
...
C:\dev\fix>dri /o /b
'dri' is not recognized as an internal or external command,
operable program or batch file.
C:\dev\fix>fix
C:\dev\fix>dir /o /b
.github
Fix
Fix.Tests
...
C:\dev>az vm lisr
'lisr' is misspelled or not recognized by the system.
Did you mean 'list' ?
Examples from AI knowledge base:
az vm list
List all VMs.
https://aka.ms/cli_ref
Read more about the command in reference docs
C:\dev>fix
C:\dev>az vm list
...
C:\dev>az vm list
User [email protected] does not exist in MSAL token cache. Run `az login`.
C:\dev>fix
C:\dev>az login
...
- Windows only (sorry!)
- Dotnet 5.0 installed
- Just copy the fix.exe file to your path.
- fix.exe -debug : shows debug information.
- fix.exe -plan : only shows the fixed command but doesn't execute it.
Thanks to some code written by Jim Mischel in 2006, we are able to access native Windows APIs responsible to get hold of the Console active buffer via c# (P/Invoke).
From there, we go up the buffer until we find the last typed command (check ActionManager class method GetLastCommand).
Then we pass the last command and lines returned by it as input to all the registered "CommandFixers". The first one who can understand and fix the error returns a solution and our tool then executes the new command. When none of them can do the job, we say I'm sorry ;)
There, you fixed!
Check it out here: Contribution guidelines for this project
Use this on your own risk! We are not responsible for any damage this little tool might cause to your machine. Fix it will execute commands in your console, so check the source code to understand what these might be.
Project License can be found here.