UNPKG

@titan-suite/cli

Version:

The complete smart contract development tool

28 lines (27 loc) 949 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const command_1 = require("@oclif/command"); const child_process_1 = require("child_process"); const fs = require("fs"); class Exec extends command_1.Command { run() { return tslib_1.__awaiter(this, void 0, void 0, function* () { const { args } = this.parse(Exec); const exists = fs.existsSync(args.file); if (args.file && exists) { child_process_1.spawn('node', [args.file], { stdio: 'inherit', cwd: process.cwd() }); } else { throw new Error('Please specify a file to run'); } }); } } Exec.description = 'Run a custom helper script'; Exec.examples = ['$ titan exec <path/to/script.js>']; Exec.flags = { help: command_1.flags.help({ char: 'h' }) }; Exec.args = [{ name: 'file' }]; exports.default = Exec;