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

     1  package autocomplete
     2  
     3  import "sync"
     4  
     5  type globalExesT struct {
     6  	ptr   *map[string]bool
     7  	mutex sync.Mutex
     8  }
     9  
    10  func NewGlobalExes() *globalExesT {
    11  	ge := new(globalExesT)
    12  	ptr := make(map[string]bool)
    13  	ge.ptr = &ptr
    14  	return ge
    15  }
    16  
    17  func (ge *globalExesT) Get() *map[string]bool {
    18  	ge.mutex.Lock()
    19  	ptr := ge.ptr
    20  	ge.mutex.Unlock()
    21  	return ptr
    22  }
    23  
    24  func (ge *globalExesT) Set(ptr *map[string]bool) {
    25  	ge.mutex.Lock()
    26  	ge.ptr = ptr
    27  	ge.mutex.Unlock()
    28  }