Open troglodyne opened 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.
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.
Env variables would be good as a first iteration.
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