tclip/cmd/web/tmpl/help.tmpl
Xe Iaso ad516287c4 rename go install url
Signed-off-by: Xe Iaso <xe@tailscale.com>
2023-01-16 16:10:43 +00:00

65 lines
3.4 KiB
Cheetah

{{template "header" .}}
<p>Never seen this service before? Want to know how to use it? This page will help you learn more about your tailnet's pastebin tool.</p>
<ul>
<li><a href="#cli">Command-line tool</a></li>
<li><a href="#api">API</a>
<ul>
<li><a href="#emacs">Emacs package</a></li>
</ul>
</li>
</ul>
<h2 id="cli">Command-line tool</h2>
<p>You can pipe commands or paste files to the pastebin using the command <code>infinipaste</code>. You can install it by installing the <a href="https://go.dev">Go</a> compiler toolkit and then running this command:</p>
<pre><code>go get github.com/tailscale-dev/infinipaste/cmd/infinipaste@main</code></pre>
<p>Once it is installed, invoke it with the command <code>infinipaste</code>:</p>
<pre><code>infinipaste ./foo.txt</code></pre>
<p>and the program will print a URL that you can share with your team. You can also pipe the output from any command to it:</p>
<pre><code>go test &amp;2&lt;1 | infinipaste -n go-test.txt</code></pre>
<h2 id="api">API</h2>
<p>The pastebin service has an API call at <code>/api/post</code> that you can use to submit new pastes from command-line tools or your text editor. You use it by constructing either a basic HTML form post or a multipart form with these fields (both are required):</p>
<table>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<tr>
<td><code>filename</code></td>
<td>The name of the file you want to paste.<br />The file extension of the name will determine the syntax highlighting for that paste.</td>
</tr>
<tr>
<td><code>content</code></td>
<td>The literal content of the paste.<br />This can be a function, a bit of prose, or an entire buffer of text.</td>
</tr>
</table>
<p>The <code>Accept</code> header will determine what kind of response you get. By default, this service will return a redirect to the paste upon pastes being successfully created. If you do not want this behavior (such as if you are implementing support for your favorite text editor or testing with <code>curl</code>), set the <code>Accept</code> header to the value <code>text/plain</code>. This will make the server return the paste URL as normal text.</p>
<p>Here is an example curl command you can use to paste data to the service:</p>
<pre><code>curl http://paste/api/post -F filename=filename.txt -F content="test paste from curl" -H "Accept: text/plain"</code></pre>
<h3 id="emacs">Emacs package</h3>
<p>The default distribution of infinipaste ships with a package for <a href="https://www.gnu.org/software/emacs/">GNU Emacs</a>. This package will let you submit pastes from your editor. It requires the <a href="https://github.com/tkf/emacs-request"><code>request</code></a> package and exposes two interactive functions:</p>
<ul>
<li><code>M-x infinipaste-submit-region</code> - submits the currently highlighted region to infinipaste</li>
<li><code>M-x infinipaste-submit-buffer</code> - submits the contents of the current buffer to infinipaste</li>
</ul>
<p>You can download this package <a href="https://github.com/tailscale-dev/infinipaste/blob/main/contrib/infinipaste.el">from the infinipaste repository</a>. You can install it by using <code>M-x package-install-file</code> or by opening it in Emacs and running <code>M-x package-install-from-buffer</code>. Please be sure that <code>request</code> is installed.</p>
{{template "footer" .}}