NAME
Cli::Command - Base class for commands
DESCRIPTION
Base class for the individual CLI commands. A command takes care of (possible) input arguments and performs actions accordingly.
SYNOPSIS
A command must implement at least
package Wireguard::WGmeta::Cli::Commands::YourCommand;
use experimental 'signatures';
use parent 'Wireguard::WGmeta::Cli::Commands::Command';
# is called from the router
sub entry_point($self) {
...
}
# show cmd specific help
sub cmd_help($self) {
...
}
METHODS
new(@input_arguments)
Creates a new Command instance. The following data is accessible through $self
after calling:
my $commandline_args = $self->{input_args}; # reference to array of input arguments
my $wireguard_home = $self->{wireguard_home}; # Path to wireguard home dir
Please also take note of the effect of environment vars: "ENVIRONMENT VARIABLES" in Wireguard::WGmeta::Index
Parameters
@input_arguments
List of input args (exceptcmd
)
Returns
An instance of a Command
entry_point()
Method called from "route_command($ref_list_input_args)" in Wireguard::WGmeta::Cli::Router
cmd_help()
Stub for specific cmd help. Is expected to terminate the command by calling exit()
and print the help content directly to std_out.
check_privileges()
Check if the user has r/w access to wireguard_home
.
Raises
Exception if the user has insufficient privileges .