libgeminiclient/gemini-pipe.1

116 lines
2.6 KiB
Groff

.Dd Jun 20, 2020
.Dt GEMINI-PIPE 1
.Os
.Sh NAME
.Nm gemini-pipe
.Nd plumb gemini pages based on the returned mime-type
.Sh SYNOPSIS
.Nm
.Op Fl lw
.Op Fl c Ar cert-file
.Op Fl d Ar default-handler
.Op Fl f Ar mimedef-file
.Op Fl h Ar proxy-host
.Op Fl k Ar key-file
.Op Fl m Ar mimedef
.Op Fl p Ar port
.Op Fl r Ar max-redirects
.Op Fl t Ar tofu-file
.Ar URL ...
.Sh DESCRIPTION
Choose a pipeline to send the data received from
.Ar URL
based on the received mime-type.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl c Ar cert-file
The certificate file to use for TLS.
.It Fl d Ar default-handler
The pipeline to use when there is no matching mimedef.
The default is:
.Li $PAGER
With
.Ev PAGER
defaulting to
.Xr more 1 .
.It Fl f Ar default-handler
Parse the file as described below.
.It Fl h Ar proxy-host
The host to connect through.
.Ar proxy-host
can also specify a port number.
.It Fl k Ar key-file
The key file to use for TLS.
.It Fl l
Print a list of all mimedefs in use and exit.
.It Fl m Ar mimedef
Parse the argument as described below.
.It Fl p Ar port
Use
.Ar port
instead of the default
.Pq 1965 .
.It Fl r Ar max-redirects
Set the maximum number of redirects (5 by default).
.It Fl t Ar tofu-file
The file to read host certificate hashes from.
.It Fl w
Write any new hashes to the
.Ar tofu-file .
.El
.Pp
.Sy mimedef
strings are parsed in a manner similar to
.Xr make 1
files.
The targeted mime-type is at the beginning of the line,
and the script to run is formed from the concatenation of all of the
lines afterwards that start with a blank (tab or space) character.
The first line of a script can be on the same line as the mime-type,
separated by a blank (tab or space)character.
Examples can be found below.
.Sh ENVIRONMENT
.Bl -tag -width Ds
.It Ev GEMINI_KEYFILE
Sets the TLS key file before
.Fl k .
.It Ev GEMINI_CERTFILE
Sets the TLS certificate file before
.Fl c .
.It Ev GEMINI_TOFUFILE
Sets the TOFU tile before
.Fl t .
.It Ev GEMINI_PROXY
Sets the proxy host before
.Fl h .
.It Ev GEMINI_MAX_REDIRECTS
Sets the maximum number of redirects before
.Fl r .
.It Ev GEMINI_PORT
Sets the default port number before
.Fl p .
.It Ev GEMINI_TOFU_WRITE
If set to a non-empty string, it is equivalent to
.Fl w .
.It Ev mime
The mime-type received.
.El
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
Open an HTML file received over Gemini:
.Dl gemini-pipe -m 'text/html lynx -stdin' //example.com/index.html
.Pp
An example mimedef file:
.Bd -literal -offset indent -compact
application/octet-stream od -tx1 | $PAGER
text/html w3m -T "$mime"
text/troff nroff | $PAGER
.Ed
.Sh SEE ALSO
.Xr gemini-cat 1 ,
.Xr libgeminiclient 3 ,
.Xr tls_config_set_cert_file 3 ,
.Xr tls_config_set_key_file 3