class Ghundle::Command::Common
Provides the basic interface of a Ghundle
command. Includes some helper methods that are available in all command objects.
Inheritors are expected to override the call instance method, and they will have access to the command-line arguments through the args
method.
Attributes
args[R]
Public Class Methods
call(*args)
click to toggle source
# File lib/ghundle/command/common.rb, line 15 def self.call(*args) new(*args).call end
new(*args)
click to toggle source
# File lib/ghundle/command/common.rb, line 19 def initialize(*args) @args = args end
Private Instance Methods
config()
click to toggle source
# File lib/ghundle/command/common.rb, line 43 def config @config ||= Config end
error(*args)
click to toggle source
# File lib/ghundle/command/common.rb, line 39 def error(*args) raise AppError.new(*args) end
hook_description(hook)
click to toggle source
# File lib/ghundle/command/common.rb, line 25 def hook_description(hook) [ hook.name.foreground(:yellow), " - version: #{hook.metadata.version}", " - types: #{hook.metadata.types.join(', ')}", " - description: #{hook.metadata.description}", ].join("\n") end
possible_hook_types()
click to toggle source
# File lib/ghundle/command/common.rb, line 47 def possible_hook_types %w{ applypatch-msg commit-msg post-applypatch post-checkout post-commit post-merge post-receive post-rewrite post-update pre-applypatch pre-auto-gc pre-commit pre-push pre-rebase pre-receive prepare-commit-msg update } end
say(message)
click to toggle source
# File lib/ghundle/command/common.rb, line 34 def say(message) print '>> '.foreground(:green).bright puts message.foreground(:green) end