Command

NAME

App::Lorea::Command - A class representing a command to be run by lorea

SYNOPSIS


use App::Lorea::Watcher;
use App::Lorea::Command;

my $supply = $path.&watch-recursive(
    debounce => 0.5,
    exclude  => rx{ '~' $ }, # Ignore files ending in ~
);

.run with App::Lorea::Command.new: @args, :$is-service, :$supply;

DESCRIPTION

This module represents a command to be executed by the lorea command line client. It makes little sense to use it outside of that context.

METHODS

new

args

A List of arguments to pass to the underlying process.

is-service

A Bool to specify if this command is a service or not. A service is a command that is expected to be constantly running, and restarted on a file-system change. The alternative is a command that is most normally short-running, and is started on a file-system change.

supply

A Supply of IO::Notification::Change objects. After calling run, every string received sent to this Supply will trigger be enqueued to trigger a possible command restart.

See run for an explanation of the queueing process.

run

method run returns Promise

Start listening to events from the Supply passed to the constructor. Every event is expected to be a IO::Notification::Change. File-system changes will be queued and the queue will be processed after a 300 milliseconds have ellapsed since the last event.

How these queues work depends on whether this command represents a "service" or not.

Queues for services only keep the last event that has come in. This means that a set of events rapidly firing with less that 300 milliseconds between each will trigger a single service restart.

Queues for non-service commands keep unique events, which are processed in an unspecified order.

AUTHOR

José Joaquín Atria <[email protected]>

Copyright 2020 José Joaquín Atria

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

App::Lorea v0.2.2

A command line utility to execute commands on filesystem changes

Authors

  • José Joaquín Atria

License

Artistic-2.0

Dependencies

Getopt::LongTerminal::ANSIColorText::ShellWords:auth<github:softmoth>Timer::Stopwatch:auth<zef:jjatria>

Test Dependencies

Provides

  • App::Lorea
  • App::Lorea::Command
  • App::Lorea::Watcher

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.