Skip to content

Commit c8ec772

Browse files
Kacarottaminya
authored andcommitted
Can cooperate with Terminus (allows inputs)
1 parent 6741089 commit c8ec772

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

lib/runtime.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ export default class Runtime {
4949
// * "File Based"
5050
// input (Optional) - {String} that'll be provided to the `stdin` of the new process
5151
execute(argType = 'Selection Based', input = null, options = null) {
52-
if (atom.config.get('script.stopOnRerun')) this.stop();
53-
this.emitter.emit('start');
5452

5553
const codeContext = this.codeContextBuilder.buildCodeContext(
5654
atom.workspace.getActiveTextEditor(), argType);
@@ -62,6 +60,26 @@ export default class Runtime {
6260
const executionOptions = !options ? this.scriptOptions : options;
6361
const commandContext = CommandContext.build(this, executionOptions, codeContext);
6462

63+
64+
// Will cooperate with Terminus to allow for inputs, if user has installed.
65+
try {
66+
var terminus = require('../../terminus/lib/terminus.js').provideTerminus();
67+
} catch (e) {
68+
var terminus = null;
69+
console.log("Could not find Terminus");
70+
}
71+
if (terminus != null) {
72+
var command = commandContext.command;
73+
for (let i = 0; i < commandContext.args.length; i++) {
74+
command += ' "' + commandContext.args[i] + '"';
75+
}
76+
terminus.run(['printf "\\33c\\e[3J" && ' + command]);
77+
return;
78+
}
79+
80+
if (atom.config.get('script.stopOnRerun')) this.stop();
81+
this.emitter.emit('start');
82+
6583
if (!commandContext) return;
6684

6785
if (commandContext.workingDirectory) {

0 commit comments

Comments
 (0)