handlebars/helpers/index.js
function exec (command, options) {
  let start
  let end
  const lang = options.hash && options.hash.lang
  switch (lang) {
    case 'raw':
      start = end = ''
      break
    case 'inline':
      start = end = '`'
      break
    default:
      const fenceLanguage = lang || ''
      start = '```' + fenceLanguage + '\n'
      end = '\n```'
  }
  const output = cp.execSync(command, {
    encoding: 'utf8',
    cwd: options.hash && options.hash.cwd
  })
  return start + output.trim() + end
}
function exec (command, options) {
  let start
  let end
  const lang = options.hash && options.hash.lang
  switch (lang) {
    case 'raw':
      start = end = ''
      break
    case 'inline':
      start = end = '`'
      break
    default:
      const fenceLanguage = lang || ''
      start = '```' + fenceLanguage + '\n'
      end = '\n```'
  }
  const output = cp.execSync(command, {
    encoding: 'utf8',
    cwd: options.hash && options.hash.cwd
  })
  return start + output.trim() + end
}
function exec ( command , options ) { let start let end const lang = options . hash && options . hash . lang switch ( lang ) { case 'raw' : start = end = '' break case 'inline' : start = end = '`' break default : const fenceLanguage = lang || '' start = '```' + fenceLanguage + '\n' end = '\n```' } const output = cp . execSync ( command , { encoding : 'utf8' , cwd : options . hash && options . hash . cwd } ) return start + output . trim ( ) + end }
Execute a command and include the output in a fenced code-block.

@param {string} command the command, passed to `child-process#execSync()`
@param {object} options optional arguments and Handlebars internal args.
@param {string} options.hash.lang the language tag that should be attached to the fence
(like `js` or `bash`). If this is set to `raw`, the output is included as-is, without fences.
@param {string} options.hash.cwd the current working directory of the example process
@returns {string} the output of `execSync`, enclosed in fences.
@access public
@memberOf helpers
Execute a command and include the output in a fenced code - block .