NAME

Taskwarrior::Kusarigama::Hook::OnCommand - Role for plugins implementing custom commands

VERSION

version 0.0.1

SYNOPSIS

package Taskwarrior::Kusarigama::Plugin::Command::Foo;

use Moo;

extends 'Taskwarrior::Kusarigama::Hook';

with 'Taskwarrior::Kusarigama::Hook::OnCommand';

sub on_command {
    say "running foo";
}

1;

DESCRIPTION

Role consumed by plugins implementing a custom command.

Requires that a on_command is implemented.

By default, the command name is the name of the package minus its Taskwarrior::Kusarigama::Plugin::Command:: prefix, but it can be modified via the command_name attribute.

package MyCustom::Command;

use Moo;

extends 'Taskwarrior::Kusarigama::Hook';
with 'Taskwarrior::Kusarigama::Hook::OnCommand';

# will intercept `task custom-command`
has '+command_name' => (
    default => sub { return 'custom-command' },
);

sub on_command { ... };

AUTHOR

Yanick Champoux <yanick@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Yanick Champoux.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.