Pārlūkot izejas kodu

优化goupdate命令

Jrohy 3 gadi atpakaļ
vecāks
revīzija
e2d93822c1
1 mainītis faili ar 11 papildinājumiem un 7 dzēšanām
  1. 11 7
      install.sh

+ 11 - 7
install.sh

@@ -166,15 +166,19 @@ installGo(){
 }
 
 installUpdater(){
-    if [[ $OS == "Linux" && ! -e /usr/local/bin/goupdate ]];then
-        echo "source <(curl -L https://go-install.netlify.app/install.sh)" > /usr/local/bin/goupdate
-        chmod +x /usr/local/bin/goupdate
-    elif [[ $OS == "Darwin" && ! -e $HOME/go/bin/goupdate ]];then
-        cat > $HOME/go/bin/goupdate << EOF
+    if [[ $OS == "Linux" ]];then
+        if [[ ! -e /usr/local/bin/goupdate || -z `cat /usr/local/bin/goupdate|grep '$@'` ]];then
+            echo 'source <(curl -L https://go-install.netlify.app/install.sh) $@' > /usr/local/bin/goupdate
+            chmod +x /usr/local/bin/goupdate
+        fi
+    elif [[ $OS == "Darwin" ]];then
+        if [[ ! -e $HOME/go/bin/goupdate || -z `cat $HOME/go/bin/goupdate|grep '$@'` ]];then
+            cat > $HOME/go/bin/goupdate << 'EOF'
 #!/bin/zsh
-source <(curl -L https://go-install.netlify.app/install.sh)
+source <(curl -L https://go-install.netlify.app/install.sh) $@
 EOF
-        chmod +x $HOME/go/bin/goupdate
+            chmod +x $HOME/go/bin/goupdate
+        fi
     fi
 }