Refactor a few things
This commit is contained in:
		
							
								
								
									
										16
									
								
								run
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								run
									
									
									
									
									
								
							@@ -5,25 +5,15 @@ dry="0"
 | 
			
		||||
 | 
			
		||||
execute() {
 | 
			
		||||
    log "execute $@"
 | 
			
		||||
    if [[ $dry != "1" ]]; then
 | 
			
		||||
        "$@"
 | 
			
		||||
    fi
 | 
			
		||||
    [[ $dry != "1" ]] && "$@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
log() {
 | 
			
		||||
    if [[ $dry != "1" ]]; then
 | 
			
		||||
        echo "$@"
 | 
			
		||||
    else
 | 
			
		||||
        echo "[DRY RUN]: $@"
 | 
			
		||||
    fi
 | 
			
		||||
    [[ $dry != "1" ]] && echo "$@" || echo "[DRY RUN]: $@"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
while [[ $# > 0 ]]; do
 | 
			
		||||
    if [[ $1 == "--dry" ]]; then
 | 
			
		||||
        dry="1"
 | 
			
		||||
    else
 | 
			
		||||
        single_script_filter="$1"
 | 
			
		||||
    fi
 | 
			
		||||
    [[ $1 == "--dry" ]] && dry="1" || single_script_filter="$1"
 | 
			
		||||
    shift
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user