Skip to content

Commit 16409c5

Browse files
committed
fix: completely exit shell on 'exit' - like '.exit'
update: change multiline prompt to ... (like nodejs)
1 parent 1cfe61c commit 16409c5

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

bin/main.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ if(argv['--'].length){ // temporarily override ganache args
5151

5252
const shell = new InteractiveSolidityShell(config);
5353

54-
5554
process.on('exit', () => {
5655
shell.blockchain.stopService();
5756
if(argv['--'].length){ //restore old ganache args
@@ -61,13 +60,17 @@ process.on('exit', () => {
6160
saveFile(SESSION, shell.dumpSession())
6261
});
6362

64-
65-
6663
const vorpal = new Vorpal()
6764
.delimiter('')
6865
.show()
6966
.parse(argv._);
7067

68+
vorpal.on('client_prompt_submit', (cmd) => {
69+
if(cmd.trim() === 'exit'){
70+
process.exit(0); // exit completely from repl. otherwise, would return to main vorpal loop
71+
}
72+
});
73+
7174
vorpal
7275
.mode('repl', 'Enters Solidity Shell Mode')
7376
.delimiter(c.bold('» '))
@@ -122,7 +125,7 @@ cheers 🙌
122125
`);
123126

124127
break; //show usage
125-
case '.exit': process.exit(); //exit -> no more cb()
128+
case '.exit': process.exit(); break; //exit -> no more cb()
126129
case '.reset': shell.reset(); break; //reset complete state
127130
case '.undo': shell.revert(); break; //revert last action
128131
case '.config':
@@ -225,4 +228,5 @@ vorpal
225228

226229
/** start in repl mode */
227230
vorpal.execSync("repl")
231+
228232
//vorpal.execSync("uint a = 2") /* debug */

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function multilineInput(command){
2929
}
3030

3131
const rl = require('readline-sync');
32-
command += '\n' + rl.question("multi> ").trim()
32+
command += '\n' + rl.question("... ").trim()
3333
}
3434
return command;
3535
}

0 commit comments

Comments
 (0)