App-riap
view release on metacpan or search on metacpan
[ENHANCEMENTS]
- Cache some Riap results like meta/info/list to speed up tab
completion, help, ls.
- Alias -u for --user, -p for --password; document about
PERINCI_HTTP_{USER,PASSWORD}
[BUG FIXES]
- if 'ls' command mentions path, error 404 if there are no matches.
0.02 2013-11-27 Released-By: SHARYANTO
[BUG FIXES]
- Fix Riap requesting so it works with Riap::HTTP, etc.
- Fix tab completion on path so it mimics shell better (no space
automatically added after a match on dir).
lib/App/riap.pm view on Meta::CPAN
print Perinci::Result::Format::format($_[0], "text");
}
sub catch_run {
my $self = shift;
my ($cmd, @argv) = @_;
my $pwd = $self->state("pwd");
my $uri = concat_and_normalize_path($pwd, $cmd);
my $res = $self->riap_request(info => $uri);
if ($res->[0] == 404) {
$self->_err([404, "No such command or executable (Riap function)"]);
return;
} elsif ($res->[0] != 200) {
$self->_err($res);
return;
}
unless ($res->[2]{type} eq 'function') {
$self->_err([412, "Not an executable (Riap function)"]);
return;
}
my $name = $res->[2]{uri}; $name =~ s!.+/!!;
lib/App/riap/Commands.pm view on Meta::CPAN
$res = $shell->riap_request(list => $uri);
return $res unless $res->[0] == 200;
for (@{ $res->[2] }) {
next if defined($leaf) && length($leaf) && $_ ne $leaf;
push @allres, $_;
}
}
if (!@allres && defined($leaf) && length($leaf)) {
return [404, "No such file (Riap entity): $path"];
}
}
[200, "OK", \@allres, $resmeta];
}
$SPEC{pwd} = {
v => 1.1,
summary => 'shows current directory',
args => {
lib/App/riap/Commands.pm view on Meta::CPAN
} else {
if (is_abs_path($dir)) {
$npwd = normalize_path($dir);
} else {
$npwd = concat_and_normalize_path($opwd, $dir);
}
}
# check if path actually exists
my $uri = $npwd . ($npwd =~ m!/\z! ? "" : "/");
my $res = $shell->riap_request(info => $uri);
if ($res->[0] == 404) {
return [404, "No such directory (Riap package)"];
} elsif ($res->[0] != 200) {
return $res;
}
#return [403, "Not a directory (package)"]
# unless $res->[2]{type} eq 'package';
log_trace("Setting npwd=%s, opwd=%s", $npwd, $opwd);
$shell->state(pwd => $npwd);
$shell->state(old_pwd => $opwd);
[200, "OK"];
( run in 1.559 second using v1.01-cache-2.11-cpan-39bf76dae61 )