github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/events/onFileSystemChange/onfilesystemchange_doc.yaml (about) 1 - DocumentID: onfilesystemchange 2 Title: >+ 3 `onFileSystemChange` 4 CategoryID: events 5 Summary: >- 6 Add a filesystem watch 7 Description: |- 8 `onFileSystemChange` events are triggered whenever there is a change to a 9 watched path or file. 10 11 Payload: |- 12 The following payload is passed to the function via STDIN: 13 14 ``` 15 { 16 "Name": "", 17 "Interrupt": { 18 "Path": "", 19 "Operation": "" 20 } 21 } 22 ``` 23 24 ### Name 25 26 This is the name you specified when defining the event 27 28 ### Path 29 30 The path of the file that has triggered the event 31 32 ### Operation 33 34 This is the filesystem operation that triggered the event. The following 35 strings could be present in the **Operation** field: 36 37 * `create`: filesystem object created 38 * `remove`: filesystem object deleted 39 * `write`: filesystem object has been written to 40 * `rename`: filesystem object has been renamed 41 * `chmod`: filesystem object has had its POSIX permissions updated 42 43 Sometimes you might see more than one operation per interrupt. If that happens 44 the operation will be pipe delimited. For example `create|chmod` 45 Usage: |- 46 ``` 47 event onFileSystemChange name=path { code block } 48 49 !event onFileSystemChange name 50 ``` 51 Flags: 52 <path>: >- 53 Path of directory or file to watch for filesystem events 54 Examples: |- 55 This will automatically add any new files in your current working directory to 56 git upon file creation: 57 58 ``` 59 event onFileSystemChange example=. { 60 -> set event 61 if { $event.Interrupt.Operation =~ "create" } then { 62 git add $event.Interrupt.Path 63 } 64 } 65 ``` 66 Detail: |- 67 ### Stdout 68 69 Stdout is written to the terminal. 70 71 ### POSIX only 72 73 At this stage, this event isn't available for Windows nor Plan 9. This is 74 chiefly down to a lack of testers on either platform so rather than release 75 untested and potentially broken code, the decision was made to restrict this 76 event to Linux, macOS and UNIX systems instead. 77 Synonyms: 78 - onfilesystemchange 79 - onFileSystemChange 80 Related: 81 - event 82 - config