Sha256: 74077eb708ffc00ae1c91bb319a025792c9d3f381c7c50d80dce49afb5922993

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

include GLI


GLI.desc "Enable debugging"
switch [:d, :debug]

require Glyph::LIB/'commands/init'
require Glyph::LIB/'commands/add'
require Glyph::LIB/'commands/compile'
require Glyph::LIB/'commands/config'
require Glyph::LIB/'commands/todo'
require Glyph::LIB/'commands/outline'
require Glyph::LIB/'commands/stats'

Glyph.run 'load:tasks'
Glyph.run 'load:commands'

pre do |global,command,options,args|
	# Pre logic here
	# Return true to proceed; false to abourt and not call the
	# chosen command
	if global[:d] then
		Glyph.debug_mode = true
	end
	if !command || command.name == :help then
		puts "====================================="
		puts "Glyph v#{Glyph::VERSION}"
		puts "====================================="
	end
	true
end

post do |global,command,options,args|
	# Post logic here
end

on_error do |exception|
	raise if Glyph.library?
	if exception.is_a? Glyph::MacroError then
		exception.display
		false
	else
		if Glyph.debug? then
			Glyph.warning exception.message
			puts "\n"+"-"*20+"[ Backtrace: ]"+"-"*20
			puts "Backtrace:"
			exception.backtrace.each do |b|
				puts b
			end
			Glyph.debug_mode = false
		end
		true
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glyph-0.4.2 lib/glyph/commands.rb
glyph-0.4.1 lib/glyph/commands.rb
glyph-0.4.0 lib/glyph/commands.rb