teodesian / TestRail-Perl

Perl interface to TestRail's REST API
5 stars 8 forks source link

[Enhancement] bin script that just exposes the API methods #166

Open troglodyne opened 2 years ago

troglodyne commented 2 years ago

Was talkin' with Dave Lanning and others at cPanel today who expressed interest in exposing the API methods on the CLI so that they don't have to write perl oneliners for the same stuff.

Not a priority, just figured I'd file it in case it sounds interesting

polloparatodos commented 2 years ago

Sounds like this could for sure make things easier. Maintaining a list of one-liners isn't super fun, but running a bin script and pass an arg or two, I bet it would see some good use.

teodesian commented 2 years ago

recommended approach: use Package::Stash to list all the CODE symbols as hash and then use that as a lookup table for specific handlers plugged up to the API methods which you dispatch subcommands to. E.G.

my %map = (
getUsers => sub { ... },
...
);

$sub = "TestRail::API::".shift @ARGV;
$map->{$sub}->(@ARGV);

Most of the methods are so similar you could probably have a (mostly) generic arg parser handle 80% of it.

matttrach commented 2 years ago

Env variables would be good as a first iteration.