aboutsummaryrefslogtreecommitdiff
path: root/gmi.pl
diff options
context:
space:
mode:
Diffstat (limited to 'gmi.pl')
-rwxr-xr-xgmi.pl9
1 files changed, 5 insertions, 4 deletions
diff --git a/gmi.pl b/gmi.pl
index 9a58b46..5be6e00 100755
--- a/gmi.pl
+++ b/gmi.pl
@@ -10,7 +10,7 @@ use bytes;
use feature qw(refaliasing);
no warnings qw(experimental::refaliasing);
-our $VERSION = 'v0.0.20';
+our $VERSION = 'v0.0.21';
# TODO:
# back() only works once; should fix this
@@ -39,8 +39,8 @@ my @history;
my $prompt = "";
my %commands = (
- 'url' => [sub { url($_[0],0) }, 'Go to the specified URL.'],
- 'u' => [sub { url($_[0],0) }, 'Alias of `url\''],
+ 'url' => [sub { url($_[0]) }, 'Go to the specified URL.'],
+ 'u' => [sub { url($_[0]) }, 'Alias of `url\''],
'urlrelative' => [sub { urlrelative($_[0]) }, "Navigate the current URL relatively.\n\n"
."Note: if the current path is '/blog/my-post1.gmi' and 'my-post2.gmi'\n" .
@@ -209,7 +209,8 @@ sub url {
sub urlrelative {
my ($urlr) = @_;
- if (!$current_url) {print "Relative movement impossible: no current URL.\n"; return 1;}
+ if (! $urlr) { $urlr = ""}
+ if (! $current_url) {print "Relative movement impossible: no current URL.\n"; return 1;}
my $end_with_slash = 1 if ($urlr =~ m|/$|);
my $dot_only = 1 if ($urlr =~ m|^\.$|);
my $dot_2_only = 1 if ($urlr =~ m|^\.\.$|); # since we are going up into a dir