A formatting and request tool for the gemini protocol. Inspired by the Go tool.
Go to file
sloum 2ff8b13585 Merges in upstream changes 2021-06-27 22:36:36 -07:00
.gitignore Removes dead files, adds readme, adds license 2020-05-20 11:50:13 -07:00
LICENSE Corrects date 2020-05-20 11:50:50 -07:00
README.md Removes problematic markup 2020-05-20 11:57:20 -07:00
go.mod Adds conversion to html 2021-06-27 22:34:07 -07:00
main.go Merges in upstream changes 2021-06-27 22:36:36 -07:00

README.md

gemini - a tool for gemini users

gemini is a tool inspired by the go toolchain. While there is no gemini language to compile, I have built a few different useful items and bundled them together here as a single program.

Features

gemini, the tool, offers a few different command options. All of them print to stdout and stderr by default, allowing for easy piping or redirection.

fmt

gemini can format your text/gemini files in a consistent and spec compliant way. The following transformations will occur:

  • Normalizes link lines to fit this structure: => <url> or this one, if applicable, => <url> <text>
    • Will show an error if => is encountered at the beginning of a line with no further text on the line
  • Normalizes list items as: * <text>
  • Normalizes headings as: # <text> (for each heading level)
    • Will show an error if a heading level greater than 3 is supplied, but will leave the line as is
  • Will remove any consecutive white-space characters from normal text (but does not adjust newlines)
  • Will make no modifications to preformatted text blocks except for the removal of trailing white-space
  • Allows alt text on an opening pre block and normalizes it to have a single space before the alt text
    • Will show an error if alt text appears on the closing line of a pre block, but will leave the line as is

* The last two items are not currently specced, but being formatted here as a beta feature that may be removed or modified in the future

fmt takes a path to the file you want to format, as well as a few flags: -s will supress error messaging, -o will write to a given output file instead of std out,

get

gemini can retrieve documents for you and print them to std out or, with the -o flag, to a file of your choosing. The -header flag will cause the request to just return the header.

Client certificates are being worked on and should be an available feature shortly.

By default a regular get request will print only the response body. If the response is a redirect, it will automatically be followed. If the response is an error, nothing will br printed to stdout, but the error will be printed to stderr and it will inclead the response header.

spec

The api for this may change in the future. At present this is just a prelinked get request to the spec. In the future I may add spec parsing so specific sections can be requested. If so, this command may change to doc.

Building

This should build with any reasonably recent version of Go. I plan to make precompiled binaries available for a number of systems once this is a little more polished.

For the time being I recommend using go build or go install for building. If things get more complicated I will eventually include a Makefile and a man page.

Future

Have a feature you'd like to see here? Open an issue and I'll try to add it. I would like this to be a sort of swiss army knife for gemini productivity. I may eventually include a small and simple little test server to be run on localhost as well.

License

MIT License:

(c) Brian Evans 2020

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.