Coder Social home page Coder Social logo

sunaku / binman Goto Github PK

View Code? Open in Web Editor NEW
36.0 3.0 1.0 250 KB

๐Ÿค“ Creates manual pages from header comments

Home Page: https://sunaku.github.io/binman/man

License: ISC License

Ruby 100.00%
manpages documentation-tool command-line-tool

binman's People

Contributors

sunaku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

honeyryderchuck

binman's Issues

ronn

Have you ever take a look at ronn (https://github.com/rtomayko/ronn) ?

I kind of like your binman approach of extracting the markup from the bin file. However ronn has some nice features. I wonder if ronn can be used as a drop in replacement for md2man?

Can't generate man pages for multi-project repositories

I'm targeting this use-case: multiple related projects under the same directory tree (like rails, where active* gems are organized in the same repo, but published separately). All the sub-projects are organized as a standard, rubygem, i.e. they contain a lib/ directory and a bin/ directory. There is a centralized Rakefile and Gemfile shared by all in the root directory.

What I'd like to do: integrate binman in the separate publishing pipelines. For each project, I'd like to state the "target main directory", that is the directory from which to look for a bin/ directory, and where to generate the target man/ to.

This library assumes the directory where the Rakefile is located to be the target directory. This works for the common case where one repo = one project, but not for this use case. My proposal: make this a customized parameter (?).

Comment out md in the binman example and remove =begin and =end to fix ruby coloring

This example works without any changes to your code and plays better with coloring.
Thanks for binman!

#!/usr/bin/env ruby
# # BINMAN 1 2013-05-08 3.3.0
# 
# ## NAME
# 
# binman - man pages for bin scripts
# 
# ## SYNOPSIS
# 
# `binman` [*OPTION*]... *COMMAND*
# 
# ## DESCRIPTION
# 
# [binman] produces UNIX manual pages for your executable scripts. It can
# extract their leading comment headers (defined below), convert them from
# markdown(7) into roff(7) using [md2man], and display them using man(1).
# 
# ### Leading comment headers
# 
# A leading comment header can be one of the following two things:
# 
#1.  A contiguous sequence of single-line comments (which begin with `#`
#     and optionally continue with a single space followed by any number of
#     characters until the end of the line) starting at the beginning of the
#     file (after shebang and encoding comments plus optional blank lines) and
#     ending at the first single blank line.
# 
#2.  The first embedded document delimited by `=begin` and `=end` lines, which
#     begin with the respective delimiters and optionally continue with a single
#     space followed by any number of characters until the end of the line.
# 
# ### Markdown processing divergence
# 
# Although your leading comment headers are written in markdown(7), `binman
# conv` inherits the following additions to markdown(7) syntax from [md2man]:
# 
#   * There can be at most one top-level heading (H1).  It is emitted as `.TH`
#     in the roff(7) output to define the UNIX manual page's header and footer.
# 
#   * Paragraphs whose lines are all uniformly indented by two spaces are
#     considered to be "indented paragraphs".  They are unindented accordingly
#     before emission as `.IP` in the roff(7) output.
# 
#   * Paragraphs whose subsequent lines (all except the first) are uniformly
#     indented by two spaces are considered to be a "tagged paragraphs".  They
#     are unindented accordingly before emission as `.TP` in the roff(7) output.
# 
# ### Markdown processing extensions
# 
# The following [Redcarpet] extensions are enabled while processing markdown(7):
# 
#   * tables
#   * autolink
#   * superscript
#   * strikethrough
#   * no\_intra\_emphasis
#   * fenced\_code\_blocks
# 
# ## OPTIONS
# 
# `-h`, `--help`
#   Show this help manual.
# 
# ## COMMANDS
# 
# `help` *FILE* [*ARGUMENT*]...
#   If the given *ARGUMENT* sequence contains `-h` or `--help` except after
#   `--`, then this program extracts the given *FILE*'s leading comment header,
#   converts it into roff(7), and displays it using man(1) before exiting with
#   status code `0`.  Otherwise, this program exits with status code `111`.
# 
# `show` [*FILE*]
#   Use man(1) to display the roff(7) conversion of the leading comment header
#   extracted from the given *FILE* or STDIN.
# 
# `load` [*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.
# 
# `conv` [*FILE*]
#   Print the roff(7) conversion of the markdown(7) document read from the given
#   *FILE* or STDIN.
# 
# ## SEE ALSO
# 
# man(1), roff(7), markdown(7)
# 
# [binman]: https://github.com/sunaku/binman
# [md2man]: https://github.com/sunaku/md2man
# [Redcarpet]: https://github.com/vmg/redcarpet

require 'binman'

command, source = ARGV

if command == 'help'
  BinMan.help source, ARGV[2..-1]
  exit 111
else
  BinMan.help
  source ||= STDIN
  case command
  when 'show'
    BinMan.send(command, source)
  when 'load', 'dump', 'conv'
    puts BinMan.send(command, source)
  else
    warn 'binman: invalid command; try --help'
    exit 1
  end
end

gem install binman fails to install

Here is the issue

$ gem in binman -V
HEAD https://api.rubygems.org/api/v1/dependencies
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=binman
200 OK
Getting SRV record failed: DNS result has no information for _rubygems._tcp.api.rubygems.org
GET https://api.rubygems.org/api/v1/dependencies?gems=opener
200 OK
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/.gitignore
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/Gemfile
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/LICENSE
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/README.markdown
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/Rakefile
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/VERSION.markdown
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/bin/binman
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/bin/binman-help
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/bin/binman-html
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/bin/binman-rake
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/bin/binman-roff
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/bin/binman-show
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/bin/binman-text
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/binman.gemspec
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/lib/binman.rb
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/lib/binman/rakefile.rb
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/lib/binman/version.rb
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/man/index.html
/Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0/man/man0/README.html
ERROR:  While executing gem ... (Gem::Package::PathError)
    installing into parent path /Users/kron/.gem/ruby/2.3.0/README.markdown of /Users/kron/.gem/ruby/2.3.0/gems/binman-5.1.0 is not allowed

I've tried to install md2man, but got this problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.