Sha256: 978f119a9027856dc345e7ab9faed1e6cf7cc67f63d6effb2414c90d790dd218

Contents?: true

Size: 783 Bytes

Versions: 4

Compression:

Stored size: 783 Bytes

Contents

module Capricorn
  require 'thor'
  require 'yaml'

  class Util  < Thor
    namespace "default"

    require 'capricorn-util/internal'

    def self.banner(task)
      "#{banner_base} #{task.formatted_usage(self, true)}"
    end

    def help(meth=nil)
      if meth && !self.respond_to?(meth)
        klass, task = Thor::Util.find_class_and_task_by_namespace(meth)
        klass.start(["-h", task].compact, :shell => self.shell)
      else
        super
      end
    end

    def method_missing(meth, *args)
      if self.class == Capricorn::Util
        meth = meth.to_s
        klass, task = Thor::Util.find_class_and_task_by_namespace(meth)
        args.unshift(task) if task
        klass.start(args, :shell => self.shell)
      else
        super
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capricorn-2.0.11 lib/capricorn-util.rb
capricorn-2.0.10 lib/capricorn-util.rb
capricorn-2.0.9 lib/capricorn-util.rb
capricorn-2.0.8 lib/capricorn-util.rb