Merge pull request #1416 from ethereum/addCommandInterpreterWarnin

add command API help + intro message in the terminal
pull/1/head
yann300 6 years ago committed by GitHub
commit 8288bf266e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      .circleci/config.yml
  2. 12
      src/app/panels/terminal.js
  3. 22
      src/lib/cmdInterpreterAPI.js

@ -26,10 +26,10 @@ jobs:
- checkout
- restore_cache:
keys:
- dep-bundle-14-{{ checksum "package.json" }}
- dep-bundle-15-{{ checksum "package.json" }}
- run: npm install
- save_cache:
key: dep-bundle-14-{{ checksum "package.json" }}
key: dep-bundle-15-{{ checksum "package.json" }}
paths:
- ~/repo/node_modules
- run: npm run lint && npm run test && npm run downloadsolc && npm run make-mock-compiler && npm run build
@ -46,10 +46,10 @@ jobs:
- checkout
- restore_cache:
keys:
- dep-bundle-9-{{ checksum "package.json" }}
- dep-bundle-10-{{ checksum "package.json" }}
- run: npm install
- save_cache:
key: dep-bundle-9-{{ checksum "package.json" }}
key: dep-bundle-10-{{ checksum "package.json" }}
paths:
- ~/repo/node_modules
- run: npm run build_debugger

@ -338,6 +338,15 @@ class Terminal {
self._cmdIndex = -1
self._cmdTemp = ''
var intro = yo`<div><div> - Welcome to Remix v0.6.4 - </div><br>
<div>You can use this terminal for: </div>
<div> - Checking transactions details and start debugging.</div>
<div> - Running JavaScript scripts.</div>
<div> - Running JavaScript scripts involving web3 if the current environement is injected provider or Web3 provider.</div>
<div> - Executing common command to interact with the Remix interface (see list of commands below). Note that these command can also be included in a JavaScript script.</div></div>`
self.commands.html(intro)
self._shell('remix.help()', self.commands, () => {})
return self._view.el
function change (event) {
@ -547,6 +556,9 @@ class Terminal {
return self.commands[name]
}
_shell (script, scopedCommands, done) { // default shell
if (script.indexOf('remix:') === 0) {
return done(null, 'This type of command has been deprecated and is not functionning anymore. Please run remix.help() to list available commands.')
}
var self = this
var context = domTerminalFeatures(self, scopedCommands)
try {

@ -1,4 +1,5 @@
'use strict'
var yo = require('yo-yo')
var async = require('async')
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
@ -18,6 +19,14 @@ class CmdInterpreterAPI {
app: self._components.registry.get('app').api,
editor: self._components.registry.get('editor').api
}
self.commandHelp = {
'remix.debug(hash)': 'Start debugging a transaction.',
'remix.loadgist(id)': 'Load a gist in the file explorer.',
'remix.loadurl(url)': 'Load the given url in the file explorer. The url can be of type github, swarm or ipfs.',
'remix.setproviderurl(url)': 'Change the current provider to Web3 provider and set the url endpoint.',
'remix.exeCurrent()': 'Run the script currently displayed in the editor',
'remix.help()': 'Display this help message'
}
}
debug (hash, cb) {
const self = this
@ -33,7 +42,7 @@ class CmdInterpreterAPI {
const self = this
self._deps.app.importExternal(url, (err, content) => {
if (err) {
toolTip(`Unable to load ${url} from swarm: ${err}`)
toolTip(`Unable to load ${url}: ${err}`)
if (cb) cb(err)
} else {
try {
@ -70,6 +79,17 @@ class CmdInterpreterAPI {
}
self._components.terminal.commands.script(content)
}
help (cb) {
const self = this
var help = yo`<div></div>`
for (var k in self.commandHelp) {
help.appendChild(yo`<div>${k}: ${self.commandHelp[k]}</div>`)
help.appendChild(yo`<br>`)
}
self._components.terminal.commands.html(help)
if (cb) cb()
return ''
}
}
module.exports = CmdInterpreterAPI

Loading…
Cancel
Save