diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..af24b16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +gemini +test* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e3811bf --- /dev/null +++ b/LICENSE @@ -0,0 +1,6 @@ +(c) 2020 Brian Evans +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b47621a --- /dev/null +++ b/README.md @@ -0,0 +1,58 @@ +# 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: `=> ` or this one, if applicable, `=> ` + - Will show an error if `=>` is encountered at the beginning of a line with no further text on the line +- Normalizes list items as: `* ` +- Normalizes headings as: `# ` (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. + diff --git a/gemini b/gemini deleted file mode 100755 index 1dae086..0000000 Binary files a/gemini and /dev/null differ diff --git a/main.go b/main.go index 1b71954..88bcb26 100644 --- a/main.go +++ b/main.go @@ -1,3 +1,10 @@ +// gemini +// a tool for gemini authors/creators/builders/admins +// (c) 2020 Brian Evans +// Available under the terms of the MIT license: +// 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. package main import ( diff --git a/test.gmi b/test.gmi deleted file mode 100644 index 3bee11d..0000000 --- a/test.gmi +++ /dev/null @@ -1,27 +0,0 @@ -This is a test file to see how - -well this formatter will work. - -=>gemini://test.com A link - -* List item 1 -*List item 2 -* List item 3 - -#Header 1 -## Header 2 -###Header 3 -#### Header 4 - -``` -This is a regular - code fence -``` Test - - -```Test - This is a fence - with an alt -``` - - diff --git a/test.txt b/test.txt deleted file mode 100644 index a532d42..0000000 --- a/test.txt +++ /dev/null @@ -1,27 +0,0 @@ -This is a test file to see how - -well this formatter will work. - -=> gemini://test.com A link - -* List item 1 -* List item 2 -* List item 3 - -# Header 1 -## Header 2 -### Header 3 -#### Header 4 - -``` -This is a regular - code fence -``` - - -``` Test - This is a fence - with an alt -``` - -