diff options
author | EuAndreh <eu@euandre.org> | 2018-12-29 19:39:04 -0200 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2018-12-29 19:39:04 -0200 |
commit | e2c68a6e801aedd77d06b8f12a358095c7d4292c (patch) | |
tree | 3bd9aa551aa1d038f6a4e837048e96bcfdacf9b0 | |
parent | Revert to file derived from template + envsubst. (diff) | |
download | euandre.org-e2c68a6e801aedd77d06b8f12a358095c7d4292c.tar.gz euandre.org-e2c68a6e801aedd77d06b8f12a358095c7d4292c.tar.xz |
Allow website subcommands to be run on any folder.
-rwxr-xr-x | website | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -37,6 +37,7 @@ use strict; use warnings; use Getopt::Long qw(:config no_ignore_case bundling pass_through); use Pod::Usage qw(pod2usage); +use File::Basename qw(dirname); my $help = 0; my $title = ''; @@ -52,6 +53,8 @@ sub test { sub escaped_cmd { my ($cmd, @args) = @_; + my $dirname = dirname(__FILE__); + $cmd = "$dirname/$cmd"; $cmd = $cmd." \"$_\"", for @args; system($cmd); exit $? >> 8; @@ -73,10 +76,10 @@ sub dispatch { ); } elsif ($action eq 'pastebin') { my @sub_args = grep { $_ ne $action } @args; - escaped_cmd("./pastebin/website-pastebin", @sub_args); + escaped_cmd("pastebin/website-pastebin", @sub_args); } elsif ($action eq 'slides') { my @sub_args = grep { $_ ne $action } @args; - escaped_cmd("./slides/website-slides", @sub_args); + escaped_cmd("slides/website-slides", @sub_args); } elsif ($action eq 'test') { test(); } else { |