Sha256: 4d55df0b373034fc1718b11e62d4e6fe39b1d18ab6cf5d4ab0c5633dab25ef51
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
# encoding: utf-8 module GithubCLI class Command < Thor API_CLASSES = %w( c_l_i repo issue label tree blob reference pull commit fork ) HELP_COMMAND = 'help' class Comm < Struct.new(:namespace, :name, :desc, :usage); end def self.banner(task, namespace=true, subcommand=true) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end def self.all commands = [] Base.subclasses.each do |klass| namespace = extract_namespace(klass) next unless is_api_command?(namespace) namespace = "" if namespace.index API_CLASSES.first klass.tasks.each do |task| next if task.last.name.index HELP_COMMAND commands << Comm.new(namespace, task.last.name, task.last.description, task.last.usage) end end commands end def self.is_api_command?(klass) return false unless API_CLASSES.include?(klass.to_s) return true end def self.extract_namespace(klass) klass.namespace.split(':').last end end # Command end # GithubCLI
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
github_cli-0.1.3 | lib/github_cli/command.rb |