Sha256: 30751761afad3ee84511ae50fbc64bd659f1289adfd5f46f244196f1f4f48c2e

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents

# encoding: utf-8

include GLI::App

version Glyph::VERSION
program_desc "A rapid document authoring framework"

d "Enable debugging"
switch [:d, :debug]

d "Display documentation"
switch [:h, :help]

commands_from Glyph::LIB/"commands"

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

pre do |global,command,options,args|
	# Pre logic here
	# Return true to proceed; false to abort and not call the
	# chosen command
	if global[:d] then
		Glyph.debug_mode = true
	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
	else
		Glyph.warning exception.message
		if Glyph.debug? then
			puts "\n"+"-"*20+"[ Backtrace: ]"+"-"*20
			puts "Backtrace:"
			exception.backtrace.each do |b|
				puts b
			end
			Glyph.debug_mode = false
		end
	end
	false
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glyph-0.5.3.1 lib/glyph/commands.rb
glyph-0.5.2 lib/glyph/commands.rb