mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	fix: substitution of home dir to ~ when names in path match it
fixes edge cases like `/mnt/home/user`
This commit is contained in:
		
							parent
							
								
									4a517bde5e
								
							
						
					
					
						commit
						effd028658
					
				
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							| @ -230,7 +230,9 @@ func fmtPrompt() string { | ||||
| 	host, _ := os.Hostname() | ||||
| 	cwd, _ := os.Getwd() | ||||
| 
 | ||||
| 	cwd = strings.Replace(cwd, curuser.HomeDir, "~", 1) | ||||
| 	if strings.HasPrefix(cwd, curuser.HomeDir) { | ||||
| 		cwd = "~" + strings.TrimPrefix(cwd, curuser.HomeDir) | ||||
| 	} | ||||
| 	username := curuser.Username | ||||
| 	// this will be baked into binary since GOOS is a constant | ||||
| 	if runtime.GOOS == "windows" { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user