summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xwebsite.bats11
-rwxr-xr-xwebsite.pl63
2 files changed, 74 insertions, 0 deletions
diff --git a/website.bats b/website.bats
new file mode 100755
index 0000000..c9319ed
--- /dev/null
+++ b/website.bats
@@ -0,0 +1,11 @@
+#!/usr/bin/env bats
+
+# @test "Help: show short usage when no subcommand is given." {
+# run ./cli.pl
+# [[ "$status" -eq 1 ]]
+# }
+
+# print short usage
+# show manpage
+# create pastebin
+# create a slide
diff --git a/website.pl b/website.pl
new file mode 100755
index 0000000..cb81ff3
--- /dev/null
+++ b/website.pl
@@ -0,0 +1,63 @@
+#!/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<This program> 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)
+
+