#!/usr/bin/perl -s -Ilib
# PODNAME: dmoss-oracle
# ABSTRACT: command line tool for the DMOSS Oracle

use warnings;
use strict;

use DMOSS::Oracle;
use DMOSS::File;

our $g;

my $arg = shift;
unless ($arg) {
  print '$ dmoss-oracle <file>', "\n";
  exit(0);
}

my $ora = DMOSS::Oracle->new;

if ($g) {
  $arg =~ s/^/_/ unless ($arg =~ m/^_/);
  print join("\n", $ora->group($arg)), "\n";
  exit(0);
}

my $file = DMOSS::File->new('', $arg);
my $type = $ora->type($file);
print $type, "\n" if $type;

__END__

=pod

=encoding UTF-8

=head1 NAME

dmoss-oracle - command line tool for the DMOSS Oracle

=head1 VERSION

version 0.01_2

=head1 SYNOPSIS

    $ dmoss-corpus src/main.c

=head1 DESCRIPTION

Given a file, compute file type using L<DMOSS::Oracle>.

=head1 AUTHOR

Nuno Carvalho <smash@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Project Natura <natura@natura.di.uminho.pt>.

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

=cut
