Skip to content

Instantly share code, notes, and snippets.

@dkelosky
Last active April 20, 2022 15:18
Show Gist options
  • Save dkelosky/ede81bd97b544dd058cff1b2a3344e79 to your computer and use it in GitHub Desktop.
Save dkelosky/ede81bd97b544dd058cff1b2a3344e79 to your computer and use it in GitHub Desktop.
zowe.mjs
import { execSync } from 'child_process';
export function zowe(cmd, options) {
// build command
cmd = `zowe ${cmd}`;
if (options?.json) cmd += ` --rfj`;
// run it
try {
const resp = execSync(cmd).toString().trim();
if (!options?.silent === true) console.log(resp);
return resp;
// note errors
} catch (e) {
console.log(`Failed running ${cmd}`);
console.log(e.toString());
process.exit(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment