#!/usr/bin/perl
use strict;
my $APP = 'uncolor';

our $VERSION = '0.104';

use Pod::Usage;
use Getopt::Long;
use Term::ExtendedColor qw(uncolor);

!@ARGV and parse_from_stdin();

GetOptions(
  # - read from STDIN
  ''     => \&parse_from_stdin,
  'help' => sub { print "$APP v$VERSION\n"; pod2usage(verbose => 1); },
  'man'  => sub { pod2usage(verbose => 2); },
);

sub parse_from_stdin {
  while(<STDIN>) {
    print uncolor($_);
  }
}

for(@ARGV) {
  -f $_ and open(my $fh, '<', $_) or die($!);
  my @content = <$fh>;

  print for uncolor(@content);
}



__END__


=pod

=head1 NAME

uncolor - strip input from attached colors and attributes

=head1 USAGE

uncolor [FILE..]

=head1 DESCRIPTION

B<uncolor> takes input from files or standard input and returns in with colors
and attributes stripped.

=head1 OPTIONS

     -          read from standard input

    -h, --help  show the help and exit
    -m, --man   show the documentation and exit

=head1 REPORTING BUGS

Report bugs and/or feature requests on rt.cpan.org, the repository issue tracker
or directly to L<magnus@trapd00r.se>

=head1 AUTHOR

  Magnus Woldrich
  CPAN ID: WOLDRICH
  magnus@trapd00r.se
  http://japh.se

=head1 CONTRIBUTORS

None required yet.

=head1 COPYRIGHT

Copyright 2011 B<THIS APPLICATION>s L</AUTHOR> and L</CONTRIBUTORS> as listed
above.

=head1 LICENSE

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=head1 SEE ALSO

L<Term::ExtendedColor>

=cut

# vim: set ts=2 et sw=2: