Unit Command.Watch

Uses
Classes, Interfaces, Objects and Records
Types
Constants

Description

( This unit contains procedures for setting up and executing a watch command in the current directory. If there are changes to files in that directory, specified commands are executed. </sumamry>

Overview

Functions and Procedures

procedure WatchCommand(ABuilder: ICommandBuilder);
procedure Registry(ABuilder: ICommandBuilder);
function RunUserCommandAsRequested(const AFile: string; const AEvent: TWatcherEvent): Boolean;

Variables

RunWatcherCallback: TWatcherRunCallback;
CommandWatchTimeout: LongInt = 3600000;

Description

Functions and Procedures

procedure WatchCommand(ABuilder: ICommandBuilder);

This command aims to monitor for changes in the current directory. Changes considered are new files, changes to existing files, and file deletions.

The ignored folders are the ones that start with ".", the ones named "lib", "modules", "backup". Ignored files start with ".", with no extension, .exe, .dll and .trc.

Once the change condition is satisfied, the requested commands are executed so that their output is generated in the console.

Parameters
ABuilder
Command builder of the main application that will be used to output user instructions about the execution state of this command.
procedure Registry(ABuilder: ICommandBuilder);

Registry a watch command using the command builder from pascli.

Parameters
ABuilder
Command builder of the main application that will be used to registry the command.
function RunUserCommandAsRequested(const AFile: string; const AEvent: TWatcherEvent): Boolean;

Execute the command requested by the user, it will be passed to IPathWatcher so that it executes it. It is prepared to run the project build and tests as long as there is a respective executable. .

Parameters
AFile
Filename that triggered the action change.
AEvent
The event that triggered this procedure.

Variables

RunWatcherCallback: TWatcherRunCallback;

Allows to define another function to process the changes detected by the Watcher. The main purpose is to use this variable to easily implement unit tests.

CommandWatchTimeout: LongInt = 3600000;

Allows to set a custom timeout to wait for an change event. The main purpose is to use this variable to easily implement unit tests.


Generated by PasDoc 0.16.0.