From 551a80abbe631532bb54d0f3caa5208edcb96498 Mon Sep 17 00:00:00 2001 From: random Date: Fri, 29 Nov 2024 03:47:11 +0000 Subject: [PATCH] Upload files to "/" --- staticgen.pl | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 staticgen.pl diff --git a/staticgen.pl b/staticgen.pl new file mode 100644 index 0000000..e50f22f --- /dev/null +++ b/staticgen.pl @@ -0,0 +1,93 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +#use HTML::Template; + +$SIG{__WARN__} = sub { die @_; }; + + +=begin comment + +HOW THE ARGUMENTS ARE PROBABLY GONNA LOOK: + +--new-post +--build=(all|modified) +--publish +[...] + +TODO: + +[ ] everything + +=end comment + +=cut + +my $HELP_TEXT = << "END_HELP_TEXT"; +Usage: staticgen.pl [options] + +Put the stuff here when arguments are actually implemented. +END_HELP_TEXT + + + +sub LoadConfig +{ + my $filename = shift; + open my $cfh, "<$filename" or die "Couldn't open file!"; + + while (!eof($cfh)) + { + my $l = <$cfh>; + # ^_^ + } + + close $cfh; +} + +sub Main +{ + for my $arg (@ARGV) + { + if ($arg =~ m@^(-n|-+new-post)\z@i) + { + # something + next; + } + + if ($arg =~ m@^(-b|-+build)(=(?.+))?\z@i) + { + if (defined $+{bopt}) + { + if (lc $+{bopt} eq "all") { next; } + elsif (lc $+{bopt} eq "modified") { next; } + else { die "Invalid option for --build!"; } + } + else + { + next; + } + } + + if ($arg =~ m@^-+config=(?.+)\z@i) + { + die "Specified config file doesn't exist!" + unless -f $+{conf}; + + LoadConfig($+{conf}); + next; + } + + if ($arg =~ m@^(-p|-+publish)\z@i) + { + # something + next; + } + + die $HELP_TEXT if ($arg =~ m@^(-h|-+help)\z@i); + } +} + +&Main(); +exit 0; \ No newline at end of file