Sha256: 208a18daeb7bc133812093aa0e78e61be075a53431e152666779c383614abbaa

Contents?: true

Size: 1.99 KB

Versions: 1

Compression:

Stored size: 1.99 KB

Contents

#!/usr/bin/env ruby
#
# BINMAN 1 "2011-10-12" "0.0.1" "Ruby User Manuals"
# =================================================
#
# NAME
# ----
#
# binman - UNIX man pages for Ruby `bin/` scripts
#
# SYNOPSIS
# --------
#
# `binman` [*OPTION*]... *COMMAND*
#
# DESCRIPTION
# -----------
#
# [binman] produces UNIX man pages for your Ruby `bin/` scripts by extracting
# their leading comment header (a contiguous sequence of single-line comments
# starting at beginning of file and ending at first single blank line) and
# then converting them from markdown(7) to roff(7) using [Redcarpet2] for
# display using man(1).
#
# See for more information and resources.
#
# ### Markdown Processing Extensions
#
# Although your leading comment headers are written in markdown(7), `binman`
# introduces the following additional conventions to simplify common tasks:
#
# 1. Paragraphs beginning with bold/italic and followed by at least
#    one two-space indented line are considered to be definitions.
#    The first line of such a paragraph is the term being defined and
#    the subsequent two-space indented lines are the definition body.
#
# OPTIONS
# -------
#
# `-h`, `--help`
#   Display this manual page using man(1).
#
# COMMANDS
# --------
#
# `read` [*FILE*]
#   Print the leading comment header extracted from the given *FILE* or stdin.
#
# `dump` [*FILE*]
#   Print the roff(7) conversion of the leading comment header extracted from
#   the given *FILE* or stdin.
#
# `show` [*FILE*]
#   Use man(1) to display the roff(7) conversion of the leading comment header
#   extracted from the given *FILE* or stdin.
#
# SEE ALSO
# --------
#
# man(1), roff(7), markdown(7)
#
# [binman]: https://github.com/sunaku/binman
# [Redcarpet2]: https://github.com/tanoku/redcarpet
#

require 'binman'
BinMan.help

command, file = ARGV
file ||= STDIN

case command
when 'read' then puts BinMan.read(file)
when 'dump' then puts BinMan.dump(BinMan.read(file))
when 'show' then BinMan.show(file)
else warn "binman: unknown command: #{command}"; exit!
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
binman-0.0.1 bin/binman