aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgmi.pl27
1 files changed, 5 insertions, 22 deletions
diff --git a/gmi.pl b/gmi.pl
index 5fe0699..c872597 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.16';
+our $VERSION = 'v0.0.17';
# TODO:
# back() only works once; should fix this
@@ -47,8 +47,8 @@ my %commands = (
"The very end of the path is treated like a directory which can be confusing."],
'ur' => [sub { url($_[0],1) }, 'Alias of `urlrelative\''],
- 'cwu' => [sub { cwu() }, 'Returns the current working URL.'],
- 'c' => [sub { cwu() }, 'Alias of `cwu\'.'],
+ 'cwu' => [sub { print "$current_url\n"; }, 'Returns the current working URL.'],
+ 'c' => [sub { print "$current_url\n"; }, 'Alias of `cwu\'.'],
'links' => [sub { links() }, 'Returns the links on the current page.'],
'l' => [sub { links() }, 'Alias of `links\'.'],
@@ -147,7 +147,7 @@ sub url {
$url = "gemini://$url";
}
$url = parse_url($url);
- ### $url
+ # ## $url
# relative movement
if ($mode eq 1) {
@@ -174,9 +174,6 @@ sub url {
}
$c_url->{path} = '';
- #if ( $url->{path} =~ m|\.\.| or $url->{path} =~ m|^\./?|) {
- # pop(@$cp_url);
- #}
for (@$cp_url) {
$c_url->{path} .= "$_/"
}
@@ -209,13 +206,11 @@ sub url {
$path = "$url->{path}";
}
- #$current_url = "$url->{scheme}://$url->{host}/$path";
$current_url = return_url($url);
### $current_url
### $url
# ["absolute_url", "description"]
- #update_history( ["$url->{scheme}://$url->{host}/$path", "$url->{host}/$path"] );
update_history( ["$current_url", ""] );
# gemini spec: <URL><CR><LF>
@@ -240,10 +235,9 @@ sub url {
}
sub return_url {
- #my ($scheme, $username, $password, $host, $port, $path, $query, $fragment) = @_;
my ($url) = @_;
my $url_string;
- ### @_
+ # ## @_
if (ref($url) ne 'HASH') { # assuming string
if ($url !~ m|.*://|) {
$url =~ s|(.*)|gemini://$1|;
@@ -281,10 +275,6 @@ sub return_url {
$url_string .= "?$query" if ($query);
$url_string .= "#$fragment" if ($fragment);
- #$url = "$host/$path/$url";
- #$url = normalize_path($url);
- #$url = "$scheme://$url";
- # ## $c_url;
return $url_string;
}
@@ -301,7 +291,6 @@ sub get_links {
}
}
}
- ## @links
}
sub hist {
@@ -337,12 +326,6 @@ sub links {
else {
print("No links.\n");
}
- 0;
-}
-
-sub cwu {
- print("$current_url\n");
- 0;
}
sub nav {