mirror of
				https://github.com/flynx/git-utils.git
				synced 2025-10-30 19:50:12 +00:00 
			
		
		
		
	now quite a bit nicer UI...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									0d8d6a15b3
								
							
						
					
					
						commit
						560471acae
					
				
							
								
								
									
										70
									
								
								git-pullall
									
									
									
									
									
								
							
							
						
						
									
										70
									
								
								git-pullall
									
									
									
									
									
								
							| @ -1,12 +1,70 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
| for d in * ; do | while true ; do | ||||||
| 	# skip non-dirs... | 	case $1 in | ||||||
| 	! [ -d "$d/.git" ] && continue | 		-h|--help) | ||||||
|  | 			echo "Usage: $(basename "$0") [OPTIONS] [PATH]" | ||||||
|  | 			echo | ||||||
|  | 			echo "Options:" | ||||||
|  | 			echo "    -h --help       - print this message and exit" | ||||||
|  | 			echo "    -r --recursive  - pull directories recursively" | ||||||
|  | 			echo "    -l --list       - print found repositories and exit" | ||||||
|  | 			echo | ||||||
|  | 			exit | ||||||
|  | 			;; | ||||||
| 
 | 
 | ||||||
| 	echo $d | 		-r|--recursive) | ||||||
| 	cd "$d" | 			RECURSIVE=1 | ||||||
|  | 			shift | ||||||
|  | 			continue | ||||||
|  | 			;; | ||||||
|  | 		-l|--list) | ||||||
|  | 			LIST=1 | ||||||
|  | 			shift | ||||||
|  | 			continue | ||||||
|  | 			;; | ||||||
|  | 
 | ||||||
|  | 		-*|--*) | ||||||
|  | 			echo "Error: unknown option: \"$1\"" >&2 | ||||||
|  | 			exit | ||||||
|  | 			;; | ||||||
|  | 		*) | ||||||
|  | 			TARGET_PATH=$1 | ||||||
|  | 			break | ||||||
|  | 			;; | ||||||
|  | 	esac | ||||||
|  | done | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | TARGET_PATH=${TARGET_PATH:=.} | ||||||
|  | cd "$TARGET_PATH" | ||||||
|  | 
 | ||||||
|  | if [ $RECURSIVE ] ; then | ||||||
|  | 	DIRS=($(find . -name .git)) | ||||||
|  | else | ||||||
|  | 	DIRS=(./*/.git) | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | # no matches... | ||||||
|  | if [[ $DIRS =~ \* ]] ; then | ||||||
|  | 	echo "no repos found." >&2 | ||||||
|  | 	exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # do the update... | ||||||
|  | wd=$(pwd) | ||||||
|  | for dir in ${DIRS[@]} ; do | ||||||
|  | 	dir=${dir%.git} | ||||||
|  | 	echo $dir | ||||||
|  | 	if [ $LIST ] ; then | ||||||
|  | 		continue | ||||||
|  | 	fi | ||||||
|  | 	cd "$dir" | ||||||
| 	git pull | 	git pull | ||||||
| 	cd .. | 	cd "$wd" | ||||||
| 	echo | 	echo | ||||||
| done | done | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # vim:set sw=4 ts=4 : | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user