mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			5175367b35
			...
			59963add14
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					59963add14 | ||
| 
						 | 
					88fd6f01b9 | 
@ -20,8 +20,13 @@ func newFileHistory() (*fileHistory, error) {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	var itms []string
 | 
			
		||||
	for _, l := range strings.Split(string(data), "\n") {
 | 
			
		||||
	itms := []string{""}
 | 
			
		||||
	lines := strings.Split(string(data), "\n")
 | 
			
		||||
	for i, l := range lines {
 | 
			
		||||
		if i == len(lines) - 1 {
 | 
			
		||||
			println(i, l)
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		itms = append(itms, l)
 | 
			
		||||
	}
 | 
			
		||||
	f, err := os.OpenFile(defaultHistPath, os.O_RDWR | os.O_CREATE, 0755)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										23
									
								
								rl.go
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								rl.go
									
									
									
									
									
								
							@ -60,17 +60,22 @@ func newLineReader(prompt string) *lineReader {
 | 
			
		||||
		ctx = aliases.Resolve(ctx)
 | 
			
		||||
		
 | 
			
		||||
		if len(fields) == 1 {
 | 
			
		||||
			fileCompletions := fileComplete(query, ctx, fields)
 | 
			
		||||
			if len(fileCompletions) != 0 {
 | 
			
		||||
				for _, f := range fileCompletions {
 | 
			
		||||
					name := strings.Replace(query + f, "~", curuser.HomeDir, 1)
 | 
			
		||||
					if info, err := os.Stat(name); err == nil && info.Mode().Perm() & 0100 == 0 {
 | 
			
		||||
						continue
 | 
			
		||||
			prefixes := []string{"./", "../", "/", "~/"}
 | 
			
		||||
			for _, prefix := range prefixes {
 | 
			
		||||
				if strings.HasPrefix(query, prefix) {
 | 
			
		||||
					fileCompletions := fileComplete(query, ctx, fields)
 | 
			
		||||
					if len(fileCompletions) != 0 {
 | 
			
		||||
						for _, f := range fileCompletions {
 | 
			
		||||
							name := strings.Replace(query + f, "~", curuser.HomeDir, 1)
 | 
			
		||||
							if info, err := os.Stat(name); err == nil && info.Mode().Perm() & 0100 == 0 {
 | 
			
		||||
								continue
 | 
			
		||||
							}
 | 
			
		||||
							completions = append(completions, f)
 | 
			
		||||
						}
 | 
			
		||||
						compGroup[0].Suggestions = completions
 | 
			
		||||
					}
 | 
			
		||||
					completions = append(completions, f)
 | 
			
		||||
					return "", compGroup
 | 
			
		||||
				}
 | 
			
		||||
				compGroup[0].Suggestions = completions
 | 
			
		||||
				return "", compGroup
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// filter out executables, but in path
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user