Module: GithubCLI::Manpage
Constant Summary collapse
- MANPAGES =
%w[ gcli-authorize.1 gcli-config.1 gcli-repo.1 gcli.1 gcli-whoami.1 ]
Instance Method Summary collapse
-
#groff ⇒ Object
The groff command with extra arguments to turn roff into terminal output.
- #has?(command) {|_self| ... } ⇒ Boolean
-
#has_groff? ⇒ Boolean
Check if groff is installed on the system.
-
#has_man? ⇒ Boolean
Check if man is installed on the system.
- #show(command) ⇒ Object
Instance Method Details
#groff ⇒ Object
The groff command with extra arguments to turn roff into terminal output
21 22 23 |
# File 'lib/github_cli/manpage.rb', line 21 def groff "groff -Wall -mtty-char -mandoc -Tascii" end |
#has?(command) {|_self| ... } ⇒ Boolean
15 16 17 |
# File 'lib/github_cli/manpage.rb', line 15 def has?(command) yield self if MANPAGES.include? command end |
#has_groff? ⇒ Boolean
Check if groff is installed on the system
26 27 28 |
# File 'lib/github_cli/manpage.rb', line 26 def has_groff? System.command? 'groff' end |
#has_man? ⇒ Boolean
Check if man is installed on the system
31 32 33 |
# File 'lib/github_cli/manpage.rb', line 31 def has_man? System.command? 'man' end |
#show(command) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/github_cli/manpage.rb', line 35 def show(command) root = File.("../man", __FILE__) if has_groff? system "#{groff} #{root}/#{command} | #{Pager.pager_command}" else system "#{Pager.pager_command} #{root}/#{command}.txt" end end |