Sha256: 7e923e4f4a1aec109ea7e7b21cf5c6ddbed611108de70c9dd010c8ba2f42c51b

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# coding: utf-8

require "githelp/version"
require 're_expand'

require "githelp/args"
require "githelp/files"
require "githelp/params"
require "githelp/patterns"
require "githelp/tags"
require "githelp/numbers"
require "githelp/branches"
require "githelp/changes"
require "githelp/glossary"
require "githelp/git_check"

module Githelp
  #
  # パタンを指定してコマンド候補リストを得る
  #
  def githelp(pat)

    datadir = File.expand_path('../../data', __FILE__)
    # $LOAD_PATH.unshift File.expand_path('../data', __FILE__)

    entries = []
    Dir.open(datadir).each { |file|
      next unless File.file?("#{datadir}/#{file}")
      next if file !~ /\.rb$/
      # require file
      a = eval File.read("#{datadir}/#{file}")
      entries += a if a
    }

    g = ExpandRuby::Generator.new # re_expandのジェネレータ
    entries.each { |entry|
      g.add entry[0], entry[1] if entry
    }
    res = g.generate pat
    listed = {}
    res[0].find_all { |a| # 0 ambig
      if listed[a[1]]
        false
      else
        listed[a[1]] = true
      end
    }
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
githelp-0.1.4 lib/githelp.rb