mirror of
				https://github.com/lukechilds/zsh-nvm.git
				synced 2025-10-30 14:46:28 +08:00 
			
		
		
		
	Don't set lazy loaders that conflict with existing globals
This commit is contained in:
		
							parent
							
								
									de3c3d7826
								
							
						
					
					
						commit
						aa1fccff4b
					
				| @ -78,12 +78,19 @@ _zsh_nvm_lazy_load() { | ||||
|   # Add nvm | ||||
|   global_binaries+=('nvm') | ||||
| 
 | ||||
|   # Remove any binaries that conflict with current globals | ||||
|   local cmds | ||||
|   cmds=() | ||||
|   for bin in $global_binaries; do | ||||
|     _zsh_nvm_has $bin || cmds+=($bin) | ||||
|   done | ||||
| 
 | ||||
|   # Create function for each command | ||||
|   for cmd in $global_binaries; do | ||||
|   for cmd in $cmds; do | ||||
| 
 | ||||
|     # When called, unset all lazy loaders, load nvm then run current command | ||||
|     eval "$cmd(){ | ||||
|       unset -f $global_binaries | ||||
|       unset -f $cmds | ||||
|       _zsh_nvm_load | ||||
|       $cmd \"\$@\" | ||||
|     }" | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Luke Childs
						Luke Childs