add mpd-host switcher
This commit is contained in:
		
							parent
							
								
									8a7dc568b8
								
							
						
					
					
						commit
						0663ffc9af
					
				
					 1 changed files with 18 additions and 0 deletions
				
			
		
							
								
								
									
										18
									
								
								aliases/mpd
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								aliases/mpd
									
										
									
									
									
								
							|  | @ -1,5 +1,23 @@ | ||||||
| #!/bin/zsh | #!/bin/zsh | ||||||
| 
 | 
 | ||||||
|  | mpd-host() { | ||||||
|  | 	case "$1" in | ||||||
|  | 		set) | ||||||
|  | 			echo "MPD_HOST='$2';MPD_PORT='$3'" > ~/.cache/mpd-host.zsh | ||||||
|  | 			;; | ||||||
|  | 		get) | ||||||
|  | 			if [ ! -f ~/.cache/mpd-host.zsh ]; then | ||||||
|  | 				echo "MPD_HOST='localhost';MPD_PORT='6600'" > ~/.cache/mpd-host.zsh | ||||||
|  | 			fi | ||||||
|  | 			cat ~/.cache/mpd-host.zsh | ||||||
|  | 			;; | ||||||
|  | 		*) | ||||||
|  | 			echo "Usage: mpd-host set HOST PORT" | ||||||
|  | 			echo "       mpd-host get" | ||||||
|  | 			;; | ||||||
|  | 	esac | ||||||
|  | } | ||||||
|  | 
 | ||||||
| mpc() { | mpc() { | ||||||
| 	eval $(mpd-host get) | 	eval $(mpd-host get) | ||||||
| 	export MPD_HOST | 	export MPD_HOST | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 crater2150
						crater2150