#!/usr/bin/env perl
|
|
|
|
=pod
|
|
|
|
=head1 NAME
|
|
|
|
pieces-add - add URLs to the collection of pieces
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
pieces-add: stashes a filesystem path for use with other utilities
|
|
|
|
USAGE:
|
|
pieces add uri_to_add
|
|
|
|
EXAMPLE:
|
|
pieces add *.txt
|
|
|
|
=head1 AUTHOR
|
|
|
|
Brennen Bearnes
|
|
|
|
=cut
|
|
|
|
use warnings;
|
|
use strict;
|
|
use 5.10.0;
|
|
|
|
use App::Pieces;
|
|
use Cwd qw(cwd abs_path);
|
|
use Getopt::Long;
|
|
use Pod::Usage;
|
|
use URI;
|
|
|
|
GetOptions(
|
|
# 'config=s' => \$config_file,
|
|
help => sub { pod2usage(0) },
|
|
) or pod2usage(2);
|
|
|
|
my $p = App::Pieces->new();
|
|
|
|
my @addresses;
|
|
foreach my $addy (@ARGV) {
|
|
my $uri = URI->new($addy);
|
|
if ($uri->has_recognized_scheme) {
|
|
say "add: " . $uri->canonical;
|
|
push @addresses, $uri->canonical;
|
|
} else {
|
|
say "unrecognized scheme: " . $addy;
|
|
}
|
|
}
|
|
|
|
$p->add(@addresses);
|