init commit, add base for run scripts
This commit is contained in:
		
							
								
								
									
										43
									
								
								run
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										43
									
								
								run
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					#!/bin/zsh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					single_script_filter=""
 | 
				
			||||||
 | 
					dry="0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					execute() {
 | 
				
			||||||
 | 
					    log "execute $@"
 | 
				
			||||||
 | 
					    if [[ $dry != "1" ]]; then
 | 
				
			||||||
 | 
					        "$@"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					log() {
 | 
				
			||||||
 | 
					    if [[ $dry != "1" ]]; then
 | 
				
			||||||
 | 
					        echo "$@"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        echo "[DRY RUN]: $@"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while [[ $# > 0 ]]; do
 | 
				
			||||||
 | 
					    if [[ $1 == "--dry" ]]; then
 | 
				
			||||||
 | 
					        dry="1"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        single_script_filter="$1"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    shift
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					script_dir=$(cd $(dirname "${ZSH_SOURCE[0]}") &> /dev/null && pwd)
 | 
				
			||||||
 | 
					log "run // script_dir: $script_dir -- args: $single_script_filter"
 | 
				
			||||||
 | 
					cd $script_dir
 | 
				
			||||||
 | 
					scripts=$(find ./runs -maxdepth 1 -mindepth 1 -type f)
 | 
				
			||||||
 | 
					for script in $scripts; do
 | 
				
			||||||
 | 
					    if [[ -x $script ]]; then
 | 
				
			||||||
 | 
					        if echo "$script" | grep -qv "$single_script_filter"; then
 | 
				
			||||||
 | 
					            log "filter is $single_script_filter // ignoring: $script"
 | 
				
			||||||
 | 
					            continue
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					        execute ./$script
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										3
									
								
								runs/neovim
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								runs/neovim
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					#!/bin/zsh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "setup script for neovim"
 | 
				
			||||||
		Reference in New Issue
	
	Block a user