#!/usr/bin/env nix-shell #!nix-shell -i perl -p perl less --pure =head1 NAME cli.pl - Using GetOpt::Long and Pod::Usage =head1 SYNOPSIS sample [options] [file ...] Options: --help brief help message --man full documentation =head1 OPTIONS =over 4 =item B<-h, --help> Print a brief help message and exits. =item B<--man> Prints the manual page and exits. =back =head1 DESCRIPTION B will read the given input file(s) and do something useful with the contents thereof. =cut use strict; use warnings; use Getopt::Long qw(:config no_ignore_case bundling auto_help auto_version); use Pod::Usage qw(pod2usage); my $help = 0; my $title = ''; GetOptions( "t|title=s" => \$title, 'help|h|?' => \$help ) or pod2usage(-verbose => 1); pod2usage( -verbose => 2, -exitval => 0 ) if $help || (defined $ARGV[0] and $ARGV[0] eq "help"); ## If no arguments were given, then allow STDIN to be used only ## if it's not connected to a terminal (otherwise print usage) pod2usage("$0: No files given.") if ((@ARGV == 0) && (-t STDIN)); print `fd sh`; print `find . -type f -name '*sh*'`; # FIXME: add tests (inline + bats)