#!/usr/bin/env perl6

use Perl6::Tidy;

# Use the subset Indent-Style to check arguments before they get to MAIN.
#
sub MAIN( Str $filename,
		Bool :$strip-comments = False,
		Bool :$strip-pod = False,
		Bool :$strip-documentation = False,
		Indent-Style :$indent-style = 'none',
		Bool :$indent-with-spaces = False ) {
	my $text = $filename.IO.slurp;

	my $pt = Perl6::Tidy.new(
		:strip-comments( $strip-comments ),
		:strip-pod( $strip-pod ),
		:strip-documentation( $strip-documentation ),
		:indent-style( $indent-style ),
		:indent-with-spaces( $indent-with-spaces )
	);
	say $pt.tidy( $text );
}
