Sha256: 1d22f2471e8623fcd09c42810c007edb963cc814c602f436e12cf0fea9017349

Contents?: true

Size: 916 Bytes

Versions: 5

Compression:

Stored size: 916 Bytes

Contents

# encoding: utf-8

module GithubCLI
  module Manpage
    extend self

    MANPAGES = %w[
      gcli-authorize.1
      gcli-config.1
      gcli-repo.1
      gcli.1
      gcli-whoami.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

5 entries across 5 versions & 1 rubygems

Version Path
github_cli-0.6.2 lib/github_cli/manpage.rb
github_cli-0.6.1 lib/github_cli/manpage.rb
github_cli-0.6.0 lib/github_cli/manpage.rb
github_cli-0.5.9 lib/github_cli/manpage.rb
github_cli-0.5.8 lib/github_cli/manpage.rb