Sha256: bdf737e51f067927b00719e915ebcc134bda76444fb183b6246b6f149a0d4432

Contents?: true

Size: 842 Bytes

Versions: 8

Compression:

Stored size: 842 Bytes

Contents

# encoding: utf-8

module GithubCLI
  module Manpage
    extend self

    MANPAGES = %w[
      gcli-config.1
    ]

    def has?(command)
      yield self if MANPAGES.include? command
    end

    # The groff command with extra arguments to turn
    # roff into terminal output
    def groff
      "groff -Wall -mtty-char -mandoc -Tascii"
    end

    # Check if groff is installed on the system
    def has_groff?
      System.command? 'groff'
    end

    # Check if man is installed on the system
    def has_man?
      System.command? 'man'
    end

    def show(command)
      root = File.expand_path("../man", __FILE__)

      if has_groff?
        system "#{groff} #{root}/#{command} | #{Pager.pager_command}"
      else
        system "#{Pager.pager_command} #{root}/#{command}.txt"
      end
    end

  end # Manpage
end # GithubCLI

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
github_cli-0.5.7 lib/github_cli/manpage.rb
github_cli-0.5.6 lib/github_cli/manpage.rb
github_cli-0.5.5 lib/github_cli/manpage.rb
github_cli-0.5.4 lib/github_cli/manpage.rb
github_cli-0.5.3 lib/github_cli/manpage.rb
github_cli-0.5.2 lib/github_cli/manpage.rb
github_cli-0.5.1 lib/github_cli/manpage.rb
github_cli-0.5.0 lib/github_cli/manpage.rb