JSPM

interpolate-shell

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q32813F
  • License VOL

Takes a string that has placeholders containing shell commands, replaces the placeholders with the stdout value of their shell commands, and calls a callback with the result.

Package Exports

  • interpolate-shell

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (interpolate-shell) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

interpolate-shell

Takes a string that has placeholders containing shell commands, replaces the placeholders with the stdout value of their shell commands, and calls a callback with the result.

install

npm install interpolate-shell

example

const interpolateShell = require('interpolate-shell')

interpolateShell('id: {{ id -u }}', (errors, result) => {
  result // 'id: 1000'
})

interpolateShell('id: ${ id -u }', {left: '${', right: '}'}, (errors, result) => {
  result // 'id: 1000'
})

API

interpolateShell(template, [options], cb)

  • template: string
  • options: object
    • left: string, {{ left delimiter
    • right: string, }} right delimiter
    • ignoreErrors: boolean, false process template even if a command fails. By default, running commands will be killed and there will be no result when a command fails.
  • cb: function (errors, result)