Skip to content

rubytune/man_parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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...