class Octokom::Command

Public Class Methods

execute() { || ... } click to toggle source

Override ‘Clamp::Command.execute` method so it can be used as a block.

# File lib/octokom/command.rb, line 35
def self.execute(&block)
  define_method(:execute, block) do
    yield if block_given?
  end
end
flag(tags, desc, &block) click to toggle source

Shortcut for ‘Clamp::Command.option` with `:flag` argument.

For example:

flag ['-a'], A option'

Is the same as:

option ['-a'], :flag, 'A option'
# File lib/octokom/command.rb, line 17
def self.flag(tags, desc, &block)
  option_without_type(tags, :flag, desc, &block)
end
option_with_type(tags, desc, &block) click to toggle source

Alias for the ‘Clamp::Command.option` method that uses the long option tag as type string.

For example:

Octokom::Command.option ['-a', '--abc'], 'ABC option'

Is the same as:

Clamp::Command.option ['-a', '--abc'], 'ABC', 'ABC option'
# File lib/octokom/command.rb, line 29
def self.option_with_type(tags, desc, &block)
  type = tags.first[/^--(.*)$/, 1].upcase
  option_without_type(tags, type, desc, &block)
end

Public Instance Methods

authenticate() { |authenticate| ... } click to toggle source
# File lib/octokom/command.rb, line 66
def authenticate(&block)
  yield Octokom::Client.authenticate
end
git() click to toggle source

Initializes a new Repository instance that is available in all Octokom::Command instances.

# File lib/octokom/command.rb, line 62
def git
  @git ||= Octokom::Repository.new(verbose?)
end