github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/shell/autocomplete/execs_plan9.go (about)

     1  //go:build plan9
     2  // +build plan9
     3  
     4  package autocomplete
     5  
     6  import (
     7  	"io/ioutil"
     8  	"strings"
     9  
    10  	"github.com/lmorg/murex/utils/consts"
    11  )
    12  
    13  func listExes(path string, exes map[string]bool) {
    14  	files, _ := ioutil.ReadDir(path)
    15  	for _, f := range files {
    16  		if f.IsDir() {
    17  			continue
    18  		}
    19  
    20  		// TODO: There is a log of logic missing in here that appears in the unix source
    21  		exes[f.Name()] = true
    22  	}
    23  }
    24  
    25  func matchExes(s string, exes map[string]bool) (items []string) {
    26  	for name := range exes {
    27  		if strings.HasPrefix(name, s) {
    28  			if name != consts.NamedPipeProcName {
    29  				items = append(items, name[len(s):])
    30  			}
    31  		}
    32  	}
    33  
    34  	return
    35  }