def write_to_output(content)
      if output
        logger.debug "write_to_output called with output : #{output}"
        if overwrite_output?
          logger.debug "writing output to : #{output}"
          File.open(output, 'wb') {|f| f.write(content) }
        else
          logger.info "existing file not overwritten.  To overwrite automatically, use the '--force' option."
        end
      else
        logger.debug "writing to STDOUT"
        print content
      end
      return 0
    end
def write_to_output(content)
      if output
        logger.debug "write_to_output called with output : #{output}"
        if overwrite_output?
          logger.debug "writing output to : #{output}"
          File.open(output, 'wb') {|f| f.write(content) }
        else
          logger.info "existing file not overwritten.  To overwrite automatically, use the '--force' option."
        end
      else
        logger.debug "writing to STDOUT"
        print content
      end
      return 0
    end
TODO: add exception handler and pass return values