Преглед на файлове

Adding local hit to git-create

Sam Jaffe преди 8 години
родител
ревизия
63b872abd9
променени са 2 файла, в които са добавени 7 реда и са изтрити 2 реда
  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"