App-Du-Analyze

 view release on metacpan or  search on metacpan

bin/analyze-du  view on Meta::CPAN

version 0.2.2

=head1 DESCRIPTION

This analyzes the output of C<\du .> looking for directories with a certain
prefix, a certain depth and possibly sorting the output by size. It aims to
aid in finding the most space-consuming components in the directory tree
on the disk.

One can specify the filename as the last argument, or using the environment
variable C<ANALYZE_DU_INPUT_FN> . If none of them are specified, it defaults
to using the standard input (STDIN).

=head1 VERSION

version 0.2.2

=head1 SYNPOSIS

B<analyze-du> --prefix=progs/ --depth=1 --sort
B<analyze-du> -p progs/ -d

bin/analyze-du  view on Meta::CPAN

=item B<--man>

Displays the man page.

=item B<--version>

Displays the version.

=back

=head1 EXAMPLE OUTPUT

    $ export ANALYZE_DU_INPUT_FN="$(pwd)/t/data/fc-solve-git-du-output.txt"
    $ analyze-du -p "fc-solve" -d 1
    16      fc-solve/tests
    120     fc-solve/docs
    172     fc-solve/scripts
    232     fc-solve/arch_doc
    276     fc-solve/rejects
    392     fc-solve/benchmarks
    2920    fc-solve/site
    4192    fc-solve/source
    44208   fc-solve/presets

lib/App/Du/Analyze.pm  view on Meta::CPAN


    if ($version)
    {
        print "analyze-du.pl version $App::Du::Analyze::VERSION\n";
        exit(0);
    }

    my $in_fh;

    my $filename;
    if ( !defined( $filename = $ENV{ANALYZE_DU_INPUT_FN} ) )
    {
        $filename = shift(@argv);
    }

    if ( !defined($filename) )
    {
        $in_fh = \*STDIN;
    }
    else
    {

t/app.t  view on Meta::CPAN

    return eq_or_diff( $got_output, $expected_output, $blurb, );
}

# TEST:$test_filter_on_fc_solve=0;
sub test_filter_on_fc_solve
{
    local $Test::Builder::Level = $Test::Builder::Level + 1;
    my ( $args, $expected_output, $blurb ) = @_;

    {
        local $ENV{ANALYZE_DU_INPUT_FN} = $input_filename;

        # TEST:$test_filter_on_fc_solve+=$test_filter_on_fc_solve__proto;
        test_filter_on_fc_solve__proto( $args, $expected_output,
            "$blurb - ENV", );
    }

    {
        # TEST:$test_filter_on_fc_solve+=$test_filter_on_fc_solve__proto;
        test_filter_on_fc_solve__proto( [ @$args, $input_filename ],
            $expected_output, "$blurb - arg", );



( run in 1.192 second using v1.01-cache-2.11-cpan-4e96b696675 )