diff --git a/libs/remixd/src/bin/remixd.ts b/libs/remixd/src/bin/remixd.ts index d0f52556e3..c93ca872ca 100644 --- a/libs/remixd/src/bin/remixd.ts +++ b/libs/remixd/src/bin/remixd.ts @@ -63,6 +63,7 @@ function errorHandler (error: any, service: string) { .description('Establish a two-way websocket connection between the local computer and Remix IDE for a folder') .option('-u, --remix-ide ', 'URL of remix instance allowed to connect') .option('-s, --shared-folder ', 'Folder to share with Remix IDE (Default: CWD)') + .option('-i, --install ', 'Module name to install locally') .option('-r, --read-only', 'Treat shared folder as read-only (experimental)') .on('--help', function () { console.log('\nExample:\n\n remixd -s ./shared_project -u http://localhost:8080') @@ -71,6 +72,12 @@ function errorHandler (error: any, service: string) { await warnLatestVersion() + if(program.install && !program.readOnly) { + const availableModulesToInstall = ['slither'] + const service = program.install + if(availableModulesToInstall.includes(program.install)) services[service](false)['install']() + } + if (!program.remixIde) { console.log('\x1b[33m%s\x1b[0m', '[WARN] You can only connect to remixd from one of the supported origins.') } else { diff --git a/libs/remixd/src/services/slitherClient.ts b/libs/remixd/src/services/slitherClient.ts index c689aba86a..e9b13170e1 100644 --- a/libs/remixd/src/services/slitherClient.ts +++ b/libs/remixd/src/services/slitherClient.ts @@ -14,7 +14,7 @@ export class SlitherClient extends PluginClient { constructor (private readOnly = false) { super() - this.methods = ['analyse'] + this.methods = ['analyse', 'install'] } setWebSocket (websocket: WS): void { @@ -25,6 +25,10 @@ export class SlitherClient extends PluginClient { this.currentSharedFolder = currentSharedFolder } + install (): void { + console.log('inside slither install method') + } + mapNpmDepsDir (list) { const remixNpmDepsPath = utils.absolutePath('.deps/npm', this.currentSharedFolder) const localNpmDepsPath = utils.absolutePath('node_modules', this.currentSharedFolder)