#!/usr/bin/env perl
use strict;
use warnings;
use FindBin qw($Bin);
use lib "$Bin/../lib";
use Data::Dumper;
use OptArgs;

opt help => (
    isa     => 'Bool',
    alias   => 'h',
    ishelp  => 1,
    comment => 'print this help message and exit',
);

opt dry_run => (
    isa     => 'Bool',
    comment => 'do nothing',
    alias   => 'n',
);

arg arg1 => (
    isa      => 'Str',
    comment  => 'a mandatory argument',
    required => 1,
);

arg arg2 => (
    isa     => 'Num',
    comment => 'an argument whose value defaults to "optional"',
    default => 'optional',
    greedy  => 1,
);

#die usage();

my $opts = optargs;

use Encode qw/encode_utf8 decode_utf8/;
$opts->{osname}          = $^O;
$opts->{plain}           = $opts->{arg1};
$opts->{is_utf8}         = utf8::is_utf8( $opts->{arg1} );
$opts->{encode}          = encode_utf8( $opts->{arg1} );
$opts->{decode}          = decode_utf8( $opts->{arg1} );
$opts->{'decode.encode'} = decode_utf8( encode_utf8( $opts->{arg1} ) );

print Dumper($opts);

