diff --git a/fetch-all.sh b/fetch-all.sh index d6bd9fa..58d1eab 100755 --- a/fetch-all.sh +++ b/fetch-all.sh @@ -5,16 +5,21 @@ # fetch does not effect local files, just updating information about repo from remote. # # will only search symbolic links when passed "-l" option, must be before any locations -# fetch-all.sh [-l] # current location implied -# fetch-all.sh [-l] ~/my-projects /var/group-projects +# will only search hidden directories when passed "-h" option, must be before any locations +# fetch-all.sh [-l][-h] # current location implied +# fetch-all.sh [-l][-h] ~/my-projects /var/group-projects -# check for "-l" in command prompt +# check for "-l" and "-h" in command prompt followLinks="-H" -while getopts "l" option; do +checkHidden="-not -path */.*/.git" +while getopts "lh" option; do case $option in l) followLinks="-L" ;; + h) + checkHidden="" + ;; esac done shift "$((OPTIND-1))" @@ -23,6 +28,10 @@ if [[ "-H" == "$followLinks" ]]; then echo "use -l to follow symbolic links" fi +if [[ -n "$checkHidden" ]]; then + echo "use -h to check hidden directories" +fi + # function to process each location function process_git_fetch () { startedIn=`pwd` @@ -39,5 +48,5 @@ function process_git_fetch () { # and call process_git_fetch on each location that was found. # we then work on the folder that contained the ".git" folder. -find "$followLinks" "$@" -type d -name ".git" | while read -r file; do process_git_fetch "$file"; done +find "$followLinks" "$@" -type d -name ".git" $checkHidden | while read -r file; do process_git_fetch "$file"; done diff --git a/list-all.sh b/list-all.sh index 80901d3..b9ebcb6 100755 --- a/list-all.sh +++ b/list-all.sh @@ -5,16 +5,21 @@ # just listing where repos are located, and their remote. # # will only search symbolic links when passed "-l" option, must be before any locations -# list-all.sh [-l] # current location implied -# list-all.sh [-l] ~/my-projects /var/group-projects +# will only search hidden directories when passed "-h" option, must be before any locations +# list-all.sh [-l][-h] # current location implied +# list-all.sh [-l][-h] ~/my-projects /var/group-projects -# check for "-l" in command prompt +# check for "-l" and "-h" in command prompt followLinks="-H" -while getopts "l" option; do +checkHidden="-not -path */.*/.git" +while getopts "lh" option; do case $option in l) followLinks="-L" ;; + h) + checkHidden="" + ;; esac done shift "$((OPTIND-1))" @@ -23,6 +28,10 @@ if [[ "-H" == "$followLinks" ]]; then echo "use -l to follow symbolic links" fi +if [[ -n "$checkHidden" ]]; then + echo "use -h to check hidden directories" +fi + # function to process each location function process_git_list () { startedIn=`pwd` @@ -39,5 +48,5 @@ function process_git_list () { # and call process_git_list on each location that was found. # we then work on the folder that contained the ".git" folder. -find "$followLinks" "$@" -type d -name ".git" | while read -r file; do process_git_list "$file"; done +find "$followLinks" "$@" -type d -name ".git" $checkHidden | while read -r file; do process_git_list "$file"; done diff --git a/pull-all.sh b/pull-all.sh index a73b01c..cd204c9 100755 --- a/pull-all.sh +++ b/pull-all.sh @@ -5,16 +5,21 @@ # pull will not go through if there are uncommitted local changes, or if the branch has no upstream. # # will only search symbolic links when passed "-l" option, must be before any locations -# pull-all.sh [-l] # current location implied -# pull-all.sh [-l] ~/my-projects /var/group-projects +# will only search hidden directories when passed "-h" option, must be before any locations +# pull-all.sh [-l][-h] # current location implied +# pull-all.sh [-l][-h] ~/my-projects /var/group-projects -# check for "-l" in command prompt +# check for "-l" and "-h" in command prompt followLinks="-H" -while getopts "l" option; do +checkHidden="-not -path */.*/.git" +while getopts "lh" option; do case $option in l) followLinks="-L" ;; + h) + checkHidden="" + ;; esac done shift "$((OPTIND-1))" @@ -23,6 +28,10 @@ if [[ "-H" == "$followLinks" ]]; then echo "use -l to follow symbolic links" fi +if [[ -n "$checkHidden" ]]; then + echo "use -h to check hidden directories" +fi + # function to process each location function process_git_pull () { startedIn=`pwd` @@ -39,5 +48,5 @@ function process_git_pull () { # and call process_git_pull on each location that was found. # we then work on the folder that contained the ".git" folder. -find "$followLinks" "$@" -type d -name ".git" | while read -r file; do process_git_pull "$file"; done +find "$followLinks" "$@" -type d -name ".git" $checkHidden | while read -r file; do process_git_pull "$file"; done diff --git a/status-all.sh b/status-all.sh index c25d56b..c900b02 100755 --- a/status-all.sh +++ b/status-all.sh @@ -5,16 +5,21 @@ # just listing current status of repos, # # will only search symbolic links when passed "-l" option, must be before any locations -# status-all.sh [-l] # current location implied -# status-all.sh [-l] ~/my-projects /var/group-projects +# will only search hidden directories when passed "-h" option, must be before any locations +# status-all.sh [-l][-h] # current location implied +# status-all.sh [-l][-h] ~/my-projects /var/group-projects -# check for "-l" in command prompt +# check for "-l" and "-h" in command prompt followLinks="-H" -while getopts "l" option; do +checkHidden="-not -path */.*/.git" +while getopts "lh" option; do case $option in l) followLinks="-L" ;; + h) + checkHidden="" + ;; esac done shift "$((OPTIND-1))" @@ -23,8 +28,12 @@ if [[ "-H" == "$followLinks" ]]; then echo "use -l to follow symbolic links" fi +if [[ -n "$checkHidden" ]]; then + echo "use -h to check hidden directories" +fi + # function to process each location -function process_git_list () { +function process_git_status () { startedIn=$(pwd) location=$(realpath $(dirname "$@")) line="--- --- --- --- --- --- --- --- --- ---" @@ -88,5 +97,5 @@ function process_git_list () { # and call process_git_list on each location that was found. # we then work on the folder that contained the ".git" folder. -find "$followLinks" "$@" -type d -name ".git" | while read -r file; do process_git_list "$file"; done +find "$followLinks" "$@" -type d -name ".git" $checkHidden | while read -r file; do process_git_status "$file"; done