Module: CommandKit::Man

Included in:
Help::Man
Defined in:
lib/command_kit/man.rb

Overview

Allows displaying man pages.

Examples

man "passwd"
man "passwd", section: 5

Since:

  • 0.2.0

Instance Method Summary collapse

Instance Method Details

#man(page, section: nil) ⇒ Boolean?

Displays the given man page.

Examples:

man "passwd"

Display a man-page from a specific section:

man "passwd", section: 5

Parameters:

  • page (String)

    The man page file name.

  • section (Integer, String, nil) (defaults to: nil)

    The optional section number to specify.

Returns:

  • (Boolean, nil)

    Specifies whether the man command was successful or not. Returns nil when the man command is not installed.

Since:

  • 0.2.0



36
37
38
39
40
41
42
# File 'lib/command_kit/man.rb', line 36

def man(page, section: nil)
  if section
    system('man',section.to_s,page.to_s)
  else
    system('man',page.to_s)
  end
end