github.com/golazy/golazy@v0.0.7-0.20221012133820-968fe65a0b65/lazydev/filewatcher/README.md (about)

     1  # filewatcher
     2  
     3  Package filewatcher notifies when the filesystem has change.
     4  It goes up to the top directory that holds a go.mod file
     5  
     6  ## Variables
     7  
     8  IgnoredDirs is a list of directories that should not tirgger a change
     9  
    10  ```golang
    11  var IgnoredDirs = []string{".git", "log"}
    12  ```
    13  
    14  IgnoredFiles is a list of files that should not trigger a change
    15  
    16  ```golang
    17  var IgnoredFiles = []string{}
    18  ```
    19  
    20  ## Types
    21  
    22  ### type [Change](/filewatcher.go#L27)
    23  
    24  `type Change struct { ... }`
    25  
    26  Change represent a change in the filesystem
    27  
    28  ### type [ChangeSet](/filewatcher.go#L33)
    29  
    30  `type ChangeSet []Change`
    31  
    32  ChangeSet is a collection of changes
    33  
    34  ### type [FileWatcher](/filewatcher.go#L36)
    35  
    36  `type FileWatcher struct { ... }`
    37  
    38  FileWatcher looks for changes in the top most directory that have a go.mod
    39  
    40  #### func [New](/filewatcher.go#L45)
    41  
    42  `func New(dir string) (fw *FileWatcher, err error)`
    43  
    44  New initializes a FileWatcher in the given directory
    45  It will go up to the top most directory that holds a go.mod
    46  If dir is an empty string it will use the current directory
    47  
    48  #### func (*FileWatcher) [Close](/filewatcher.go#L68)
    49  
    50  `func (fw *FileWatcher) Close() error`
    51  
    52  Close stop listening for changes in the file system
    53  Once close, the channel will be closed
    54  
    55  #### func (*FileWatcher) [Watch](/filewatcher.go#L73)
    56  
    57  `func (fw *FileWatcher) Watch() (<-chan (ChangeSet), error)`
    58  
    59  Watch start watching for recursively in the project
    60  
    61  ### type [Op](/filewatcher.go#L19)
    62  
    63  `type Op fsnotify.Op`
    64  
    65  Op holds the operation name
    66  
    67  #### func (Op) [String](/filewatcher.go#L22)
    68  
    69  `func (o Op) String() string`
    70  
    71  String return the operation name Create , Write , Remove , Rename or Chmod
    72  
    73  ---
    74  Readme created from Go doc with [goreadme](https://github.com/posener/goreadme)