Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
ae90c173
Commit
ae90c173
authored
Sep 20, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cmdinterpreter
parent
359c4d2e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
1 deletion
+45
-1
app.js
src/app.js
+13
-1
editor-panel.js
src/app/panels/editor-panel.js
+1
-0
terminal.js
src/app/panels/terminal.js
+1
-0
cmdInterpreter.js
src/lib/cmdInterpreter.js
+30
-0
No files found.
src/app.js
View file @
ae90c173
...
@@ -40,6 +40,7 @@ var ContextualListener = require('./app/editor/contextualListener')
...
@@ -40,6 +40,7 @@ var ContextualListener = require('./app/editor/contextualListener')
var
ContextView
=
require
(
'./app/editor/contextView'
)
var
ContextView
=
require
(
'./app/editor/contextView'
)
var
BasicReadOnlyExplorer
=
require
(
'./app/files/basicReadOnlyExplorer'
)
var
BasicReadOnlyExplorer
=
require
(
'./app/files/basicReadOnlyExplorer'
)
var
toolTip
=
require
(
'./app/ui/tooltip'
)
var
toolTip
=
require
(
'./app/ui/tooltip'
)
var
CommandInterpreter
=
require
(
'./lib/cmdInterpreter'
)
var
styleGuide
=
remixLib
.
ui
.
themeChooser
var
styleGuide
=
remixLib
.
ui
.
themeChooser
var
styles
=
styleGuide
.
chooser
()
var
styles
=
styleGuide
.
chooser
()
...
@@ -204,7 +205,7 @@ function run () {
...
@@ -204,7 +205,7 @@ function run () {
var
self
=
this
var
self
=
this
if
(
window
.
location
.
hostname
===
'yann300.github.io'
)
{
if
(
window
.
location
.
hostname
===
'yann300.github.io'
)
{
modalDialogCustom
.
alert
(
`This UNSTABLE ALPHA branch of Remix has been moved to http://ethereum.github.io/remix-live-alpha.`
)
modalDialogCustom
.
alert
(
'This UNSTABLE ALPHA branch of Remix has been moved to http://ethereum.github.io/remix-live-alpha.'
)
}
else
if
(
window
.
location
.
hostname
===
'ethereum.github.io'
&&
}
else
if
(
window
.
location
.
hostname
===
'ethereum.github.io'
&&
window
.
location
.
pathname
.
indexOf
(
'/remix-live-alpha'
)
===
0
)
{
window
.
location
.
pathname
.
indexOf
(
'/remix-live-alpha'
)
===
0
)
{
modalDialogCustom
.
alert
(
`This instance of the Remix IDE is an UNSTABLE ALPHA branch.\n
modalDialogCustom
.
alert
(
`This instance of the Remix IDE is an UNSTABLE ALPHA branch.\n
...
@@ -607,10 +608,21 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -607,10 +608,21 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
}
var
staticanalysis
=
new
StaticAnalysis
(
staticAnalysisAPI
,
compiler
.
event
)
var
staticanalysis
=
new
StaticAnalysis
(
staticAnalysisAPI
,
compiler
.
event
)
// ----------------- Command Interpreter -----------------
/*
this module basically listen on user input (from terminal && editor)
and interpret them as command
*/
var
cmdInterpreter
=
new
CommandInterpreter
()
cmdInterpreter
.
event
.
register
(
'debug'
,
(
hash
)
=>
{
startdebugging
(
hash
)
})
// ---------------- Righthand-panel --------------------
// ---------------- Righthand-panel --------------------
var
rhpAPI
=
{
var
rhpAPI
=
{
config
:
config
,
config
:
config
,
cmdInterpreter
:
cmdInterpreter
,
setEditorSize
(
delta
)
{
setEditorSize
(
delta
)
{
$
(
'#righthand-panel'
).
css
(
'width'
,
delta
)
$
(
'#righthand-panel'
).
css
(
'width'
,
delta
)
self
.
_view
.
centerpanel
.
style
.
right
=
delta
+
'px'
self
.
_view
.
centerpanel
.
style
.
right
=
delta
+
'px'
...
...
src/app/panels/editor-panel.js
View file @
ae90c173
...
@@ -27,6 +27,7 @@ class EditorPanel {
...
@@ -27,6 +27,7 @@ class EditorPanel {
editor
:
opts
.
api
.
editor
,
// @TODO: instantiate in eventpanel instead of passing via `opts`
editor
:
opts
.
api
.
editor
,
// @TODO: instantiate in eventpanel instead of passing via `opts`
terminal
:
new
Terminal
({
terminal
:
new
Terminal
({
api
:
{
api
:
{
cmdInterpreter
:
self
.
_api
.
cmdInterpreter
,
getPosition
(
event
)
{
getPosition
(
event
)
{
var
limitUp
=
36
var
limitUp
=
36
var
limitDown
=
20
var
limitDown
=
20
...
...
src/app/panels/terminal.js
View file @
ae90c173
...
@@ -71,6 +71,7 @@ class Terminal {
...
@@ -71,6 +71,7 @@ class Terminal {
self
.
registerCommand
(
'error'
,
self
.
_blocksRenderer
(
'error'
),
{
activate
:
true
})
self
.
registerCommand
(
'error'
,
self
.
_blocksRenderer
(
'error'
),
{
activate
:
true
})
self
.
registerCommand
(
'script'
,
function
execute
(
args
,
scopedCommands
,
append
)
{
self
.
registerCommand
(
'script'
,
function
execute
(
args
,
scopedCommands
,
append
)
{
var
script
=
String
(
args
[
0
])
var
script
=
String
(
args
[
0
])
if
(
self
.
_api
.
cmdInterpreter
&&
self
.
_api
.
cmdInterpreter
.
interpret
(
script
))
return
scopedCommands
.
log
(
`>
${
script
}
`
)
scopedCommands
.
log
(
`>
${
script
}
`
)
self
.
_shell
(
script
,
scopedCommands
,
function
(
error
,
output
)
{
self
.
_shell
(
script
,
scopedCommands
,
function
(
error
,
output
)
{
if
(
error
)
scopedCommands
.
error
(
error
)
if
(
error
)
scopedCommands
.
error
(
error
)
...
...
src/lib/cmdInterpreter.js
0 → 100644
View file @
ae90c173
'use strict'
var
remix
=
require
(
'ethereum-remix'
)
var
EventManager
=
remix
.
lib
.
EventManager
class
CmdInterpreter
{
constructor
()
{
this
.
event
=
new
EventManager
()
}
interpret
(
cmd
)
{
if
(
!
cmd
)
return
false
for
(
var
c
in
commands
)
{
if
(
commands
[
c
].
exec
(
cmd
))
{
commands
[
c
].
action
(
this
,
cmd
)
return
true
}
}
return
false
}
}
var
commands
=
[
{
command
:
/^debug /
,
action
:
(
self
,
command
)
=>
{
self
.
event
.
trigger
(
'debug'
,
command
.
replace
(
'debug '
,
''
))
}
}
]
module
.
exports
=
CmdInterpreter
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment