Update configs due to newer programs (hypr, eza@aliasrc)
Add new features to ansible-vault-manager Add search engines to qutebrowser Add location to waybar weather
This commit is contained in:
		
							parent
							
								
									7300c7a813
								
							
						
					
					
						commit
						6f6ca6f79d
					
				
					 9 changed files with 49 additions and 16 deletions
				
			
		
							
								
								
									
										46
									
								
								.bin/ansible-vault-manager
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										46
									
								
								.bin/ansible-vault-manager
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,46 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
project_dir="$(git rev-parse --show-toplevel)"
 | 
			
		||||
 | 
			
		||||
if [ -z "$project_dir" ]; then
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
url="$(git remote get-url origin)"
 | 
			
		||||
 | 
			
		||||
re="^(https|git)(:\/\/|@)([^\/:]+)[\/:]([^\/:]+)\/(.+)(.git)*$"
 | 
			
		||||
 | 
			
		||||
if [[ $url =~ $re ]]; then
 | 
			
		||||
    #protocol=${BASH_REMATCH[1]}
 | 
			
		||||
    #separator=${BASH_REMATCH[2]}
 | 
			
		||||
    #hostname=${BASH_REMATCH[3]}
 | 
			
		||||
    user=${BASH_REMATCH[4]}
 | 
			
		||||
	repo=$(basename -s .git "${BASH_REMATCH[5]}")
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
project="$user/$repo"
 | 
			
		||||
 | 
			
		||||
if ! pass "ansible/$project" >/dev/null 2>&1; then
 | 
			
		||||
	echo "Error: ansible/$project not found in pass" >&2
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
pass_content=$(pass "ansible/$project")
 | 
			
		||||
pass_path=$project_dir/$(echo "$pass_content" | grep "path:" | cut -d' ' -f2-)
 | 
			
		||||
 | 
			
		||||
case "$1" in
 | 
			
		||||
	edit)
 | 
			
		||||
		pass edit "ansible/$project"
 | 
			
		||||
		exit 0
 | 
			
		||||
		;;
 | 
			
		||||
	deploy)
 | 
			
		||||
		pass show "ansible/$project.file" > "$pass_path"
 | 
			
		||||
		exit 0
 | 
			
		||||
		;;
 | 
			
		||||
	save)
 | 
			
		||||
		pass insert -m "ansible/$project.file" < "$pass_path"
 | 
			
		||||
		exit 0
 | 
			
		||||
		;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
echo "$pass_content" | head -n 1
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue