Tools for modeling links between files / URLs / etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
799 B

  1. #!/usr/bin/env perl
  2. =pod
  3. =head1 NAME
  4. pieces-add - add URLs to the collection of pieces
  5. =head1 SYNOPSIS
  6. pieces-add: stashes a filesystem path for use with other utilities
  7. USAGE:
  8. pieces add uri_to_add
  9. EXAMPLE:
  10. pieces add *.txt
  11. =head1 AUTHOR
  12. Brennen Bearnes
  13. =cut
  14. use warnings;
  15. use strict;
  16. use 5.10.0;
  17. use App::Pieces;
  18. use Cwd qw(cwd abs_path);
  19. use Getopt::Long;
  20. use Pod::Usage;
  21. use URI;
  22. GetOptions(
  23. # 'config=s' => \$config_file,
  24. help => sub { pod2usage(0) },
  25. ) or pod2usage(2);
  26. my $p = App::Pieces->new();
  27. my @addresses;
  28. foreach my $addy (@ARGV) {
  29. my $uri = URI->new($addy);
  30. if ($uri->has_recognized_scheme) {
  31. say "add: " . $uri->canonical;
  32. push @addresses, $uri->canonical;
  33. } else {
  34. say "unrecognized scheme: " . $addy;
  35. }
  36. }
  37. $p->add(@addresses);