nodejs-bash-completion/myUpdateSubCommand
2024-06-24 22:53:49 +02:00

19 lines
657 B
JavaScript
Executable File

#!/usr/bin/env node
const shell = require('shelljs');
// 1) Use shell object with its methods
if (!shell.which('git')) {
shell.echo('Sorry, this script requires git');
shell.exit(1);
}
// 2) or the following 'with' statement to specify that the `shell` object is the default object.
// The statements following the with statement refer to the echo methods, without specifying
// an object. JavaScript assumes the `shell` object for these references.
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with
with (shell) {
echo('hello world');
echo('-n', 'no newline at end -> ');
let str = echo('hello world');
}