Ruby: parse man source
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
Gemfile
README.markdown
Rakefile
VERSION
man_parser.gemspec

README.markdown

Parse man source

Install

sudo gem install man_parser

Usage

ManParser.parse('ls')
# all the sections
:sections=>{
  "NAME"=>"printf \\- format and print data",
  "SYNOPSIS"=>".B printf\n\\f...",
  "AUTHOR"=>"Written by David MacKenzie.",
  ...
},

# options parsed into :name, :alias, :argument, :description
:options=>[
  {:name=>"help", :description=>"display this help and exit"},
  {:name=>"version", :description=>"output version information and exit"},
  {:alias=>"Z", :name => 'context', :description=>"print any SELinux security context of each file"}
],

# description without options
:description=>".PPPrint ARGUMENT(s) according to FORMAT\n bla bla...."}

available_commands

ManParser.available_commands => array of commands that are available for parsing

source

ManParser.source('ls') => uncleaned source of man file

TODO

  • add to_html("\fBxx\fR") == "xx"

Author

Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...