#!/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,
		Indent-Amount :$indent-amount = 1,
		Operator-Style :$operator-style = 'none' ) {
	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 ),
		:indent-amount( $indent-amount ),
		:operator-style( $operator-style )
	);
	say $pt.tidy( $text );
}
