explainshell icon indicating copy to clipboard operation
explainshell copied to clipboard

Add search plugin to website

Open tgr opened this issue 11 years ago • 4 comments

(I didn't find any separate project for the website; apologies if I am posting this to the wrong place.)

An autodiscoverable OpenSearch plugin would be a nice addition to the site. Sample plugin code:

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
    <ShortName>explainshell</ShortName>
    <Description>match command-line arguments to their help text</Description>
    <InputEncoding>UTF-8</InputEncoding>
    <Image width="16" height="16" type="image/x-icon">data:image/x-icon;base64,AAABAAEAEBAAAAAAAABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGoAAAD+AAAAFAAAALkAAADsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/AAAAAAAAAPAAAADcAAAAAAAAAHYAAAAKAAAA5wAAANUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASwAAAP8AAAD/AAAAAAAAAP8AAADtAAAAAAAAAP4AAADmAAAAlwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAADeAAAAAAAAAP8AAAD9AAAAAAAAADUAAAD+AAAA+gAAAAAAAADnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACOAAAAAAAAAP4AAAB9AAAAAAAAAK0AAAD/AAAAYgAAAFEAAAAAAAAAAAAAANwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPMAAAD/AAAAAAAAAN4AAAD+AAAA0gAAAOEAAADuAAAAAAAAAAAAAAASAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAUAAAAAAAAAD+AAAACgAAAPUAAAAAAAAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO8AAAAAAAAA/gAAALYAAAC2AAAABAAAAP8AAAAAAAAAAAAAAAAAAAD+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wAAAP8AAACMAAAA6gAAAAAAAAD/AAAAAgAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAjAAAAM0AAAD+AAAA+QAAAMMAAAD9AAAAjQAAAAYAAAANAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPIAAAAOAAAAAAAAAAAAAAAAAAAAAQAAAP8AAABQAAAAIwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqwAAAP4AAAD8AAAA+wAAAPEAAAArAAAA/gAAAC4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAIAAAA/QAAAP8AAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPkAAAD+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACFAAAAAQAAAAAAAAAA//8AANP/AACnPwAAyR8AAJMvAACs9wAAyD8AAPq/AADouwAA8L8AAPwHAAD99wAA/gsAAP/zAAD/8wAA//cAAA==</Image>
    <Url type="text/html" method="GET" template="http://explainshell.com/explain">
        <Param name="cmd" value="{searchTerms}"/>
    </Url>
    <Url type="application/opensearchdescription+xml" rel="self" template="http://http://explainshell.com/opensearch.xml" />
    <moz:SearchForm>http://explainshell.com/</moz:SearchForm>
</OpenSearchDescription>

Sample code for making the plugin autodiscoverable:

<link rel="search" type="application/opensearchdescription+xml" title="explainshell" href="http://explainshell.com/opensearch.xml" />

tgr avatar Oct 05 '13 15:10 tgr

Never used this before but seems pretty harmless. Can you send a pull request, with the <Image> specified as a URL to http://explainshell.com/favicon.ico?

idank avatar Oct 05 '13 17:10 idank

It is harmless - it adds the site to the search engine dropdown (or more precisely it adds an option to add it): opensearch-1 opensearch-2 I think a data uri is preferable to a real one since the icon becomes part of the browser UI so it should work when offline. The plugin definition file can autoupdate (via the second Url tag) so you can use a data uri and still have it change when you have a new favicon.

What should I make a pull request against? I couldn't find any repository for the website.

tgr avatar Oct 05 '13 21:10 tgr

But how can you use the site if you're offline? :)

The website lives in this repository, in the explainshell/web subdirectory.

idank avatar Oct 06 '13 07:10 idank

... :eyes: found an example in the wwwild

https://github.com/nirajd/opensearch/blob/master/explainshell.xml

dubiouscript avatar Jul 12 '19 18:07 dubiouscript