Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
run a sequence of bash commands as specified by a json
Frequently you need to have a cli execute several commands. The tools execa and listr make this easy, but why go to the trouble of repeating the same boilerplate each time?
A function that generates a listr for execution of a set of bash commands using execa. You just pass in an array of commands and a listr is generated for it. You can also have:
$codeDir
placeholder, it will be dynamically replaced by targetDir
.keyName
into session
, and then you can use it by placing into a command specification that string __session.keyName__
. For instance, __session.lastName__
could be used in a command, and session
could be `{lastName: 'jones'}.First, install the package:
npm i bash-fool
Here is a sample usage:
const bashFool = require('bash-fool')
const commands = [
{
'title': 'echo a string',
'file': 'echo',
'arguments': [
'this is echoed: __session:echoedString',
],
},
{
title: 'more nothing',
file: 'echo',
arguments: [
'second echoed function',
],
},
]
const echoedString = 'foobar'
const session = { echoedString }
const targetDir = 'nonexistent'
(async () => {
let listr = await bashFool(commands, targetDir, session)
await listr.run()
// will echo: `this is echoed: foobar`
// and then: `second echoed function`
})()
FAQs
run a sequence of bash commands as specified by a json
The npm package bash-fool receives a total of 7 weekly downloads. As such, bash-fool popularity was classified as not popular.
We found that bash-fool demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.