Skip to content

Commit fd97277

Browse files
committed
add .proc command to list managed processes
fix unmatched $_ at the beginning of a line
1 parent ffe6f82 commit fd97277

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ An interactive Solidity shell with lightweight session recording.
2121
» uint b = 200
2222
» a + b + 2 + uint8(50)
2323
352
24+
» $_
25+
352
26+
» msg.sender
27+
0x70e9B09abd6A13D2F5083CD5814076b77427199F
28+
» address(uint160(address(msg.sender)))
29+
0x70e9B09abd6A13D2F5083CD5814076b77427199F
2430
```
2531

2632
### Hints

bin/main.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const { convert, multilineInput } = require('../src/utils');
1616
const CONFIG_HOME = path.join(os.homedir(), '.solidity-shell');
1717
const CONFIG_FILE = '.config';
1818

19-
const REX_PLACEHOLDER = /\s(\$_)(\s|$)/ig /* LAST_KNOWN_RESULT placeholder */
19+
const REX_PLACEHOLDER = /(^|\s)(\$_)(\s|$)/ig /* LAST_KNOWN_RESULT placeholder */
2020

2121
var LAST_KNOWN_RESULT = 'ss';
2222
var SESSION = 'previous.session';
@@ -100,7 +100,8 @@ vorpal
100100
.reset ... reset cmd history. start from scratch.
101101
102102
${c.bold('Debug:')}:
103-
.dump ... (debug) show template contract
103+
.proc ... show processes managed by solidity-shell (ganache)
104+
.dump ... show template contract
104105
.echo ... every shell needs an echo command
105106
106107
@@ -135,6 +136,11 @@ cheers 🙌
135136
}; break;
136137
case '.dump': return cb(c.yellow(shell.template()));
137138
case '.echo': return cb(c.bold(c.yellow(commandParts.slice(1).join(' '))))
139+
case '.proc':
140+
if(!shell.blockchain.proc){
141+
return cb();
142+
}
143+
return cb(`${c.bold(c.yellow(shell.blockchain.proc.pid))} - ${shell.blockchain.proc.spawnargs.join(', ')}`)
138144

139145
default:
140146
console.error(`Unknown Command: '${command}'. Type ${c.bold('.help')} for a list of commands.`);

0 commit comments

Comments
 (0)