Sfoglia il codice sorgente

Adding local hit to git-create

Sam Jaffe 8 anni fa
parent
commit
63b872abd9
2 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 2 1
      profile-git
  2. 5 1
      profile-util

+ 2 - 1
profile-git

@@ -17,8 +17,9 @@ git-create() {
   local message="Initializing repository"
   if [[ $# -ge 1 ]]; then
     for i in "$@"; do git-ignore "${i}"; done
-    message+=" with ignore lists: [ $1 $(printf ", %s" "${@:2}")]"
+    message+=" with ignore lists: [ $1$(printf ", %s" "${@:2}") ]"
   fi
+  maybe_do git-ignore-local
   git add .gitignore
   git commit -m "${message}"
 }

+ 5 - 1
profile-util

@@ -106,7 +106,11 @@ swap() {
 }
 
 has() {
-  which "${1}" &>/dev/null
+  [[ "$(type -t "${1}")" =~ function|alias|file ]]
+}
+
+maybe_do() {
+  has "${1}" && "$@"
 }
 
 alias coms="${HOME}/tools/comstore/commands.sh"