NAME
App::Dochazka::CLI::Parser - Parser for Dochazka command line client
VERSION
Version 0.021
SYNOPSIS
use Try::Tiny;
my $status;
my @tokens = split /\s+/, 'MY SAMPLE COMMAND';
try {
App::Dochazka::CLI::Parse::parse_tokens( [], \@tokens );
} catch {
$status = $_;
};
CLI COMMANDS
The parsing of CLI commands takes place in the parse_tokens
function, which calls itself recursively until it gets to a rather macabre-sounding
die send_req . . .
This causes control to return to the while loop in bin/dochazka-cli
with the return value of the send_req
, which is a status object.
All tokens should be chosen to be distinguishable by their first three characters.
GET
A lone GET
(equivalent to GET HELP
) is analogous to sending a bare GET request to the base URI.
GET BUGREPORT
The same as sending a GET request for the 'bugreport' resource.
GET COOKIE
This command dumps the cookie jar. It is client-side only, so no analogous REST resource.
GET EMPLOYEE
The same as sending a GET request for the 'employee' resource.
GET EMPLOYEE COUNT ([PRIV])
The same as sending a GET request for the 'employee/count' resource.
GET EMPLOYEE CURRENT
The same as sending a GET request for the 'employee/current' resource.
GET EMPLOYEE CURRENT PRIV
The same as sending a GET request for the 'employee/current/priv' resource.
GET EMPLOYEE EID [INTEGER]
Send a GET request for the 'employee/eid/:param' resource.
GET EMPLOYEE NICK [STRING]
Send a GET request for the 'employee/nick/:param' resource.
GET EMPLOYEE [INTEGER]
The same as sending a GET request for the 'employee/[INTEGER]' resource. For example, GET EMPLOYEE 1
should retrieve the profile of the employee 'root'.
GET HELP
The same as sending a GET request for the 'help' resource.
GET METAPARAM [STRING]
Sends the server a GET request for the resource 'metaparam/:param'
GET PRIVHISTORY
The same as sending a GET request for the 'privhistory' resource.
GET SESSION
The same as sending a GET request for the 'session' resource.
GET SITEPARAM [STRING]
Sends the server a GET request for the resource 'siteparam/:param'
GET VERSION
The same as sending a GET request for the 'version' resource.
GET WHOAMI
The same as sending a GET request for the 'whoami' resource.
PUT
A solitary 'PUT' is equivalent to 'PUT HELP'
PUT ECHO [JSON_STRING]
The same as sending a PUT request for the "echo" resource and providing a JSON string in the content body.
PUT EMPLOYEE
The same as sending a PUT request for the "employee" resource.
PUT EMPLOYEE EID [STRING]
The same as sending a PUT request for the "employee/eid/:param" resource.
PUT EMPLOYEE HELP
The same as sending a PUT request for the "employee/help" resource
PUT EMPLOYEE NICK [STRING]
The same as sending a PUT request for the "employee/nick/:param" resource.
PUT HELP
The same as sending a PUT request for the "help" resource
PUT PRIVHISTORY
The same as sending a PUT request for the "help" resource
PUT PRIVHISTORY HELP
The same as sending a PUT request for the "help" resource
POST
A solitary 'POST' is equivalent to 'POST HELP'
POST ECHO [JSON_STRING]
The same as sending a POST request for the "echo" resource and providing a JSON string in the content body.
POST EMPLOYEE
The same as sending a POST request for the "employee" resource
POST EMPLOYEE NICK
The same as sending a POST request for the "employee/nick" resource
POST HELP
The same as sending a POST request for the "help" resource
POST PRIVHISTORY
The same as sending a POST request for the "privhistory" resource