Compare commits

..

2 Commits

2 changed files with 22 additions and 12 deletions

View File

@ -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)

5
rl.go
View File

@ -60,6 +60,9 @@ func newLineReader(prompt string) *lineReader {
ctx = aliases.Resolve(ctx)
if len(fields) == 1 {
prefixes := []string{"./", "../", "/", "~/"}
for _, prefix := range prefixes {
if strings.HasPrefix(query, prefix) {
fileCompletions := fileComplete(query, ctx, fields)
if len(fileCompletions) != 0 {
for _, f := range fileCompletions {
@ -70,8 +73,10 @@ func newLineReader(prompt string) *lineReader {
completions = append(completions, f)
}
compGroup[0].Suggestions = completions
}
return "", compGroup
}
}
// filter out executables, but in path
for _, dir := range filepath.SplitList(os.Getenv("PATH")) {