Method: NanDoc::Cli::CommandMethods#command_abort

Defined in:
lib/nandoc/cli/command-methods.rb

#command_abort(msg = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/nandoc/cli/command-methods.rb', line 23

def command_abort msg=nil
  if msg.nil?
    tail = 'Aborting.'
  elsif msg.index("for more info") # not mr. right, mr. right now
    tail = ''
  else
    last = msg[-1].chr
    tail = ".?!".index(last) ? '  ' : ("\n"==last ? '' : '.  ')
    tail << 'Aborting.'
  end
  $stderr.puts "nanDoc: #{msg}#{tail}"
  exit 1
end