diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index bba6309..e072503 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -217,7 +217,7 @@ alias brewu='brew update && brew upgrade && brew cleanup && brew doctor' alias emacs="env LC_CTYPE=zh_CN.UTF-8 emacs" # rails -alias rails_setup='rails db:reset db:seed' +alias rails_setup='rails db:reset; rails db:seed RAILS_ENV=test' alias rails_test='rspec && rubocop' alias rubocop='rubocop --require rubocop-performance --format progress' alias psetup='rake parallel:setup' diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 58dae86..fa3490e 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -389,6 +389,10 @@ function klogs { PROJECT="$2" shift; shift ;; + -i) + INSTANCE="$2" + shift; shift + ;; *) finalopts+=($1) shift @@ -396,7 +400,11 @@ function klogs { esac done - kubectl --context $KCONTEXT logs -f deployment/$PROJECT --all-containers=true --since=5s --pod-running-timeout=2s $finalopts + if [[ "$PROJECT" != "" ]]; then + kubectl --context $KCONTEXT logs -f deployment/$PROJECT --all-containers=true --since=5s --pod-running-timeout=2s $finalopts + elif [[ "$INSTANCE" != "" ]]; then + kubectl --context $KCONTEXT logs -f --max-log-requests=10 -l app.kubernetes.io/instance=$INSTANCE + fi } function rgm {