 
     strings = []
     for result in results
-      strings.push elToString(result)
+      strings.push elToString(result, attribute)
 
     # Print the strings to stdout in such a way that they're all
     # separated by a newline, but the last line doesn't end in one.

#
# depending on the query given by the user, we will be getting an html element,
# or a plain old string. This should be handled elegantly.
elToString = (el) ->
  if el.innerHTML?
    log.verbose 'elToString', "Fetching innerHTML from '#{el}'."
    return el.innerHTML.trim()
  else if el.textContent?

#
# Wrapper for optimise that allows us to clean up the args as they come in.
getArgs = ->
  usage = 'Usage: bo [xpath|css]\n\n' +
    'If no attribute is given, innerHTML, text or a plain string\n' +
    'will be returned (depending on what is matched)'
  argv = optimist
    .usage(usage)
    .alias('a', 'attribute')
    .default('a', undefined)
    .alias('l', 'loglevel')
    .default('l', 'silent')
    .demand(1)
    .argv
  [ query ] = argv._
  query = query.trim()
  attribute = argv.attribute?.trim()
  loglevel = argv.loglevel.trim()
  {
    query
    attribute
    loglevel
  }

