class Sculptor::CLI::Base
Public Instance Methods
help(meth=nil, subcommand=false)
click to toggle source
# File lib/sculptor/cli.rb, line 13 def help(meth=nil, subcommand=false) if meth && !self.respond_to?(meth) klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}") klass.start(['-h', task].compact, shell: shell) else list = [] Thor::Util.thor_classes_in(Sculptor::CLI).each do |thor_class| list += thor_class.printable_tasks(false) end list.sort! { |a, b| a[0] <=> b[0] } shell.say "\n" shell.print_table(list, ident: 2, truncate: true) shell.say end end
method_missing(meth, *args)
click to toggle source
Intercept missing methods and search subtasks for them @param [Symbol] meth
# File lib/sculptor/cli.rb, line 32 def method_missing(meth, *args) meth = meth.to_s meth = self.class.map[meth] if self.class.map.key?(meth) klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}") if klass.nil? raise Thor::Error, "There's no '#{meth}' command for Sculptor. Try 'sculptor help' for a list of commands." else args.unshift(task) if task klass.start(args, shell: shell) end end
version()
click to toggle source
# File lib/sculptor/cli.rb, line 9 def version say "Sculptor #{Sculptor::VERSION} (Middleman #{Middleman::VERSION})" end