Jay Taylor's notes

back to listing index

goman - the missing man pages for Go binaries - Applied Go

[web search]
Original source (appliedgo.net)
Tags: golang go binary goman appliedgo.net
Clipped on: 2017-09-06

Image (Asset 1/5) alt=
Play
Go
binary
README
local
source
README.md
README.txt
main
repo
README
remote
repository
README.md
cmd
subrepo
README.txt

Step 4: Render Markdown as colored ANSI text

Markdown renderers usually produce HTML, in some cases PDF, and, if they value traditional typesetting, also LaTeX. Plain text with ANSI color codes is far less widespread.

Again, luck was on my side. This fork of blackfriday implements an ANSI renderer for Markdown. So getting color-coded ANSI output from a README file required little more than copying a couple of lines from mdcat that uses the ANSI renderer under the hood.

Done.

Get goman

Get goman via go get:

go get -u github.com/christophberger/goman

Usage

It’s all in the README, so simply type goman goman ;-)

TL;DR:

goman <binary>  # find and display the README of <binary>

goman <binary> | less -R  # same but with paging

And a shell script can make goman blend in with the standard man command, to auto-reveal the README if the binary has no man page. (See the README for instructions.)

Happy coding!

Did you enjoy the article? Join my mailing list and stay informed about new posts. (One email per blog post.)

Like this article? Tell your friends!
Older
Newer
Go slices are not dynamic arrays
Log in with
or sign up with Disqus
?

Disqus is a discussion network

  • Disqus never moderates or censors. The rules on this community are its own.
  • Don't be a jerk or do anything illegal. Everything is easier that way.

Read full terms and conditions

Be the first to comment.
    © 2017 Christoph Berger
    Imprint/Impressum  ·  Privacy/Datenschutz
    Find me on: