This script enhances the usage of dotnet ef
commands in Zsh by enabling tab completion and providing useful aliases for common commands.
- Tab Completion: Provides autocompletion for
dotnet ef
commands in Zsh. - Command Aliases: Shortened aliases for frequently used
dotnet ef
commands.
- Copy the script into your Zsh configuration file (e.g.,
~/.zshrc
). - Restart your terminal or run
source ~/.zshrc
to apply the changes.
The script adds tab completion for dotnet ef
commands. If dotnet
is not installed or completions fail to generate, an error message is displayed.
Alias | Command | Description |
---|---|---|
defdd |
dotnet ef database drop |
Drop the database |
defdu |
dotnet ef database update |
Update the database |
defci |
dotnet ef dbcontext info |
Get DbContext info |
defcls |
dotnet ef dbcontext list |
List DbContexts |
defco |
dotnet ef dbcontext optimize |
Optimize DbContext |
defcs |
dotnet ef dbcontext scaffold |
Scaffold DbContext from database |
defma |
dotnet ef migrations add |
Add a new migration |
defmls |
dotnet ef migrations list |
List migrations |
defmr |
dotnet ef migrations remove |
Remove the last migration |
defms |
dotnet ef migrations script |
Generate SQL script from migrations |
defv |
dotnet ef --version |
Check EF Core version |
Use defhelp
to list all available aliases:
defhelp
This will output:
Dotnet EF Aliases:
defdd - Drop the database
defdu - Update the database
defci - Get DbContext info
defcls - List DbContexts
defco - Optimize DbContext
defcs - Scaffold DbContext from database
defma - Add a new migration
defmls - List migrations
defmr - Remove the last migration
defms - Generate SQL script from migrations
defv - Check EF Core version
- This script is specific to Zsh.
- Ensure that
dotnet
anddotnet ef
are installed before using this script. - The script checks for
dotnet
availability before enabling completion.
This project is open-source and available under the MIT License.