mirror of
				https://github.com/TheLocehiliosan/yadm
				synced 2025-06-13 13:03:58 +00:00 
			
		
		
		
	Add script hooks
This commit is contained in:
		
							parent
							
								
									68937f3cad
								
							
						
					
					
						commit
						41409631a1
					
				
							
								
								
									
										14
									
								
								yadm
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								yadm
									
									
									
									
									
								
							| @ -96,10 +96,14 @@ function main() { | |||||||
|       shift |       shift | ||||||
|     done |     done | ||||||
|     [ ! -d "$YADM_WORK" ] && error_out "Work tree does not exist: [$YADM_WORK]" |     [ ! -d "$YADM_WORK" ] && error_out "Work tree does not exist: [$YADM_WORK]" | ||||||
|  |     invoke_hook "pre_$YADM_COMMAND" | ||||||
|     $YADM_COMMAND "${YADM_ARGS[@]}" |     $YADM_COMMAND "${YADM_ARGS[@]}" | ||||||
|  |     invoke_hook "post_$YADM_COMMAND" | ||||||
|   else |   else | ||||||
|     #; any other commands are simply passed through to git |     #; any other commands are simply passed through to git | ||||||
|  |     invoke_hook "pre_$1" | ||||||
|     git_command "$@" |     git_command "$@" | ||||||
|  |     invoke_hook "post_$1" | ||||||
|     retval="$?" |     retval="$?" | ||||||
|   fi |   fi | ||||||
| 
 | 
 | ||||||
| @ -827,6 +831,16 @@ function error_out() { | |||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | #: ******  Hook handler  ******S | ||||||
|  | function invoke_hook() { | ||||||
|  |   hook_name=$1 | ||||||
|  | 
 | ||||||
|  |   if [[ -x "$YADM_DIR/hooks/$hook_name.sh" ]] ; then | ||||||
|  |     debug "invoking hook: $hook_name" | ||||||
|  |     $YADM_DIR/hooks/$hook_name.sh | ||||||
|  |   fi | ||||||
|  | } | ||||||
|  | 
 | ||||||
| #; ****** Auto Functions ****** | #; ****** Auto Functions ****** | ||||||
| 
 | 
 | ||||||
| function auto_alt() { | function auto_alt() { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user