init parameterize init_db and add pzsh

This commit is contained in:
hophacker 2019-08-14 12:04:56 +08:00
parent 5e7f99c2ed
commit 8ed11a05f1
2 changed files with 14 additions and 2 deletions

View File

@ -255,4 +255,4 @@ alias vim_plain="vim -u NONE"
alias edit_alias="vim $yadr_zsh/aliases.zsh $yadr_zsh/functions.zsh -p" alias edit_alias="vim $yadr_zsh/aliases.zsh $yadr_zsh/functions.zsh -p"
alias rubocop='rubocop --require rubocop-performance --format progress' alias rubocop='rubocop --require rubocop-performance --format progress'
alias docker_purge='docker stop $(docker ps -qa);docker rm $(docker ps -qa)' alias docker_purge='docker stop $(docker ps -qa);docker rm $(docker ps -qa)'
alias init_server_db='ds rails db:create db:migrate db:seed' alias pzsh='proxychains zsh'

View File

@ -132,7 +132,19 @@ function swap() {
} }
function init_db() { function init_db() {
dc exec $1 rails db:drop db:create db:migrate db:seed SERVICE=server
while getopts ":s:" o; do
case "${o}" in
s)
SERVICE=${OPTARG}
;;
*)
echo "Usage: init_db [-s SERVICE]"
return
;;
esac
done
dc exec $SERVICE rails db:drop db:create db:migrate db:seed
} }
function cmd_exists() { function cmd_exists() {
$* &> /dev/null $* &> /dev/null