Created
May 19, 2025 11:54
-
-
Save MuhammedAlkhudiry/5da462860b451fa2e747d7c75ba76b85 to your computer and use it in GitHub Desktop.
my zsh alias
This file contains hidden or 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
alias zsh="phpstorm ~/.zshrc" | |
alias a="ddev artisan" | |
alias dl="ddev launch" | |
alias retry="a migrate:rollback && a migrate" | |
alias as="a db:seed" | |
alias am="a migrate" | |
alias ci="ddev composer install" | |
alias cr="ddev composer require" | |
alias cu="ddev composer update" | |
alias dev="npm run dev" | |
alias ds="ddev start" | |
alias test="a test --parallel" | |
alias test-no-parallel="a test" | |
alias coverage="a test --parallel --coverage --compact" | |
function remote() { | |
local namespace=$1 | |
local shell_type=${2:-bash} # Default to bash if no second argument is provided | |
if [[ $namespace == *-dev ]]; then | |
local context="preprod" | |
elif [[ $namespace == *-prod ]]; then | |
local context="production" | |
else | |
echo "Invalid namespace suffix. Please use a namespace ending with -dev or -prod." | |
return 1 | |
fi | |
pod_name=$(kubectl get pods -n "$namespace" --context "$context" | grep '^laravel-' | awk '{print $1}' | head -n 1) | |
if [ -z "$pod_name" ]; then | |
echo "No matching laravel pod found." | |
return 1 | |
fi | |
if [[ $shell_type != "bash" && $shell_type != "sh" ]]; then | |
echo "Invalid shell type. Please specify either 'bash' or 'sh'." | |
return 1 | |
fi | |
echo "Attempting to connect to pod '$pod_name' in namespace '$namespace' with shell '$shell_type'." | |
kubectl exec -n "$namespace" --context "$context" -it "$pod_name" -- $shell_type | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment