commandbox.system.modules_app.system-commands.commands

Class watch

lucee.Component
    extended by commandbox.system.modules_app.system-commands.commands.watch

Watch the files in a directory and run a custom command of your choice {code} watch *.json "echo 'config file updated!'" {code} The following environment variables will be available to your command - watcher_added - A JSON array of relative paths added in the watch directory - watcher_removed - A JSON array of relative paths removed in the watch directory - watcher_changed - A JSON array of relative paths changed in the watch directory {code} set command = "echo 'You added \${item}!'" watch command="foreach '\${watcher_added}' \${command}" --verbose {code} Note in the above example, the ${watcher_added} and ${command} env vars in the "inner" command are escaped. We also set an intermediate env var to hold the command to keep from needing to "double escape" it. This command will run in the foreground until you stop it. When you are ready to shut down the watcher, press Ctrl+C.

Class Attributes:
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
    Method Summary
    any run([string paths='**'], string command, [commandbox.system.modules_app.system-commands.commands.number delay='500'], [string directory='[runtime expression]'], [boolean verbose='false'])
     
    Methods inherited from class lucee.Component
    None

    Method Detail

    run

    public any run([string paths='**'], string command, [commandbox.system.modules_app.system-commands.commands.number delay='500'], [string directory='[runtime expression]'], [boolean verbose='false'])

    Parameters:
    paths - Command delimited list of file globbing paths to watch relative to the working directory, defaults to **
    command - The command to run when the watcher fires
    delay - How may milliseconds to wait before polling for changes, defaults to 500 ms
    directory - Working directory to start watcher in
    verbose - Output details about the files that changed