Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions examples/edge-net/pkg/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function printHelp() {

${c('bold', 'COMMANDS:')}
${c('green', 'start')} Start an edge-net node in the terminal
${c('green', 'join')} Join network with public key (multi-contributor support)
${c('green', 'benchmark')} Run performance benchmarks
${c('green', 'info')} Show package and WASM information
${c('green', 'demo')} Run interactive demonstration
Expand All @@ -119,6 +120,9 @@ ${c('bold', 'EXAMPLES:')}
${c('dim', '# Start a node')}
$ npx @ruvector/edge-net start

${c('dim', '# Join with new identity (multi-contributor)')}
$ npx @ruvector/edge-net join --generate

${c('dim', '# Run benchmarks')}
$ npx @ruvector/edge-net benchmark

Expand Down Expand Up @@ -408,13 +412,26 @@ async function runDemo() {
console.log(`${c('dim', 'For full P2P features, run in a browser environment.')}`);
}

async function runJoin() {
// Delegate to join.js
const { spawn } = await import('child_process');
const args = process.argv.slice(3);
const child = spawn('node', [join(__dirname, 'join.js'), ...args], {
stdio: 'inherit'
});
child.on('close', (code) => process.exit(code));
}

// Main
const command = process.argv[2] || 'help';

switch (command) {
case 'start':
startNode();
break;
case 'join':
runJoin();
break;
case 'benchmark':
case 'bench':
runBenchmark();
Expand Down
Loading