App-riap

 view release on metacpan or  search on metacpan

script/riap  view on Meta::CPAN

 riap> request call /Package/Sub/somefunc '{"args":{"a":1, "b":2}}'
 riap> request list /Package/Sub/somefunc '{"detail":1}'

=head2 call [options] <path> [args]

Perform C<call> Riap request. Note that C<call> command is actually optional:
the shell performs call requests by default on paths.

Examples:

 riap> call /Package/Sub/somefunc '{"foo":1, "bar":2}'

which is equivalent to:

 riap> /Package/Sub/somefunc --foo 1 --bar 2

=head2 set <name> <value>

If invoked without any argument, will list all known settings. If C<name> is
specified but C<value> is not, will show value for that particular setting. If
C<name> and C<value> is both specified, will set a setting's value.

=head1 SETTINGS

Settings are configuration and regulate how the shell behaves.

=head2 user => str

For HTTP authentication.

=head2 password => str

For HTTP authentication.

=head2 output_format => str (default: C<text>)

Set output format for command results. The same formatting is used by
L<Perinci::CmdLine>. See that module or L<Perinci::Result::Format> for more
details.

=head2 debug_riap => bool (default: 0)

Whether to show raw Riap requests and responses being sent to/received from the
server.

=head2 debug_completion => bool (default: 0)

Whether to show debugging information when doing tab completion.

=head2 debug_time_command => bool (default: 0)

Whether to show how long a command takes.

=head2 cache_period => int (default: 300)

Number of seconds to cache Riap results from server, to speed up things like tab
completion.

=head1 FAQ

=head2 The prompt looks rather garbled (e.g. extra " m >" character)!

It looks to be an issue with L<Term::ReadLine::Perl>. Try installing
L<Term::ReadLine::Gnu> instead.

=head2 How do I redirect output to files?

B<riap> is meant to be a simple shell, not a full-blown Unix shell. Besides, a
syntax like this:

 riap> call /Package/Sub/somefunc > /path/to/file

will be confusing since paths map to code entity URIs in B<riap>, not filesystem
paths.

But something like a setting might be implemented if this is a popular feature
request.

=head2 What about variables, aliases, looping, or $other_Unix_shell_feature?

Again, B<riap> is meant to be a simple shell, not a full-blown Unix shell. To do
those things, you are better off using L<peri-run> or L<peri-access> and
incorporate them in a Unix shell script. For example you can write these two
short scripts:

 # list-accounts
 #!/bin/sh
 peri-access call https://yourservice.com/api/Account/list

 # delete-account (input sanitizing is left as exercise for the readers)
 #!/bin/sh
 peri-access call "https://yourservice.com/api/Account/delete?account=$1"

and then write:

 # delete all accounts
 for a in `list-accounts`; do
     delete-account "$a"
 done

=head1 ENVIRONMENT

=head2 PERINCI_HTTP_USER => str

If set, can be used to set C<user> setting (but priority lower than command-line
option C<--user>).

=head2 PERINCI_HTTP_PASSWORD => str

If set, can be used to set C<password> setting (but priority lower than
command-line option C<--password>). This is usually more secure to use than
command-line option, because command-line option is usually visible from all
users on the system via commands like C<ps>.

=head2 RIAP_HISTFILE => str (default: C<~/.riap_history>)

Specify location of command history file. Like in shells, can be set to empty
string to disable history loading/saving.

=head2 RIAPRC => str (default: C<~/.riaprc>)

Specify location of settings file.



( run in 1.873 second using v1.01-cache-2.11-cpan-39bf76dae61 )