Verified Commit 439e2a0c authored by Luc Didry's avatar Luc Didry

Update url CLI help message

parent c81a5a11
Pipeline #71879 passed with stages
in 13 minutes and 43 seconds
Revision history for Perl application Lstu
0.18-1 2018-08-21
- Update url CLI help message
0.18-0 2018-08-20
- Add option to store IP address of URL creator
- Add command to search URL with the IP address of its creator
......
......@@ -175,11 +175,11 @@ Lstu::Command::url - Manage URL in Lstu's database
=head1 SYNOPSIS
Usage:
carton exec script/lstu url --info <short> Print infos about the URL
carton exec script/lstu url --remove <short> [--yes] Remove URL (ask for confirmation unless --yes is given)
Will print infos about URL before confirmation
carton exec script/lstu url --search <url> Search URL by its true URL (LIKE match)
carton exec script/lstu url --ip <ip address> Search URL by the IP address of its creator (exact match)
carton exec script/lstu url --info <short> <short> Print infos about the space-separated URLs
carton exec script/lstu url --remove <short> <short> [--yes] Remove the space-separated URLs (ask for confirmation unless --yes is given)
Will print infos about URL before confirmation
carton exec script/lstu url --search <url> Search URLs by its true URL (LIKE match)
carton exec script/lstu url --ip <ip address> Search URLs by the IP address of its creator (exact match)
=cut
......
......@@ -170,7 +170,7 @@ sub _is_spam {
}
} else {
my $res = $c->ua->get($url)->res;
if ($res->code >= 300 && $res->code < 400) {
if (defined($res->code) && $res->code >= 300 && $res->code < 400) {
my $new_url = Mojo::URL->new($res->headers->location);
$new_url->host($url->host) unless $new_url->host;
$new_url->scheme($url->scheme) unless $new_url->scheme;
......
......@@ -364,7 +364,7 @@ $t->get_ok($a)
# Test command
my $help = `carton exec script/lstu help url`;
like($help, qr/Print infos about the URL/m, 'Test help url command');
like($help, qr/Print infos about the space-separated URLs/m, 'Test help url command');
# Create short URL
$a = $t->ua->post('/a' => form => { lsturl => 'https://lstu.fr', format => 'json' })->res->json('/short');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment