diff options
author | EuAndreh <eu@euandre.org> | 2018-12-29 09:38:39 -0200 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2018-12-29 09:38:39 -0200 |
commit | 9934dd7fae3b881690df158b3f15a5f96c3aed72 (patch) | |
tree | e80ed6deab9006c8b5a20fdca8a912fade9c2746 /website | |
parent | Add initial Racket CLI for handling scripts. (diff) | |
download | euandre.org-9934dd7fae3b881690df158b3f15a5f96c3aed72.tar.gz euandre.org-9934dd7fae3b881690df158b3f15a5f96c3aed72.tar.xz |
WIP: Use Perl instead of Racket for CLI.
Diffstat (limited to '')
-rwxr-xr-x | website.bats | 11 | ||||
-rwxr-xr-x | website.pl | 63 |
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) + + |