     .usage(usage)
     .alias('a', 'attribute')
     .default('a', undefined)
+    .alias('o', 'outer')
+    .describe('o', 'get outer XML of the element')
     .alias('l', 'loglevel')
     .default('l', 'silent')
     .demand(1)



# Get the args
{ query, attribute, loglevel } = getArgs()
# Set our default logging level, only log items at this level and higher.
# The default loglevel is err - only show errors
log.level = loglevel

#
# This is essentially a simple logging wrapper around jsdom.env
domParse = (html, libs, cb) ->
  opts =
    html: html
    scripts: libs
    parsingMode: 'xml'
    done: (err, window) ->
      if err?
        log.error 'parse', "Error processing DOM with libs: [ '#{libs.join '\', \''}' ]. (#{err})"
        return cb err, window

      log.verbose 'parse', "DOM parse successful with libs: [ '#{libs.join '\', \''}' ]."
      cb err, window
  jsdom.env opts

# elToString
# ----------
#
# 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, attribute, outer) ->
  if attribute
    log.verbose 'elToString', "Fetching #{attribute} from '#{el}'."
    return el.getAttribute(attribute)
  else if outer && el.outerHTML?
    log.verbose 'elToString', "Fetching outerHTML from '#{el}'."
    return el.outerHTML.trim()
  else if el.innerHTML?
    log.verbose 'elToString', "Fetching innerHTML from '#{el}'."
    return el.innerHTML.trim()
