@strawci/interpreter

1.0.1 • Public • Published

🍓 StrawCI Interpreter

This package is responsible for interpreting actions in JSON format. It is made specifically for StrawCI.

👷 Constructor

const Interpreter = require("@strawci/interpreter");
const interpreter = new Interpreter();

📝 Action Body

{
    "type": "bash",
    "arg": "Command to be executed"
}

💻 Functions

// Run a single action
interpreter
    .runAction({
        type: "bash",
        arg: "echo Hello world",
    })
    .then(({ stdout, stderr }) => {
        console.log(stdout || stderr);
        console.log("Finished");
    });

// Run multiple actions
const actions = [
    { type: "bash", arg: "echo First command" },
    { type: "bash", arg: "echo Second command" },
    { type: "bash", arg: "echo Third command" },
    { type: "bash", arg: "echo Fourth command" },
];

interpreter
    .runActions(actions, (err, stdout, stderr) => {
        console.log(stdout || stderr);
    })
    .catch((e) => {
        console.error("Failed running command: " + e);
    })
    .then(() => {
        console.log("Finished.");
    });

❤️ The End

Made with Love by Sammwy

Readme

Keywords

none

Package Sidebar

Install

npm i @strawci/interpreter

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

3.78 kB

Total Files

6

Last publish

Collaborators

  • sammwy