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
b95fc58c
Unverified
Commit
b95fc58c
authored
Oct 18, 2018
by
yann300
Committed by
GitHub
Oct 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1550 from ethereum/addRemixCommands
Add remix command "setFile"
parents
b8514e72
5c16a383
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
pluginAPI.js
src/app/plugin/pluginAPI.js
+1
-0
cmdInterpreterAPI.js
src/lib/cmdInterpreterAPI.js
+15
-1
No files found.
src/app/plugin/pluginAPI.js
View file @
b95fc58c
...
...
@@ -123,6 +123,7 @@ module.exports = (pluginManager, fileProviders, fileManager, compiler, udapp) =>
provider
.
set
(
path
,
content
,
(
error
)
=>
{
if
(
error
)
return
cb
(
error
)
fileManager
.
syncEditor
(
path
)
cb
()
})
}
else
{
cb
(
path
+
' not available'
)
...
...
src/lib/cmdInterpreterAPI.js
View file @
b95fc58c
...
...
@@ -28,7 +28,8 @@ class CmdInterpreterAPI {
offsetToLineColumnConverter
:
self
.
_components
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
}
self
.
commandHelp
=
{
'remix.getFile(path)'
:
'Returns te content of the file located at the given path'
,
'remix.getFile(path)'
:
'Returns the content of the file located at the given path'
,
'remix.setFile(path, content)'
:
'set the content of the file located at the given path'
,
'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, ipfs or raw http'
,
...
...
@@ -172,6 +173,19 @@ class CmdInterpreterAPI {
cb
(
'file not found'
)
}
}
setFile
(
path
,
content
,
cb
)
{
cb
=
cb
||
function
()
{}
var
provider
=
this
.
_deps
.
fileManager
.
fileProviderOf
(
path
)
if
(
provider
)
{
provider
.
set
(
path
,
content
,
(
error
)
=>
{
if
(
error
)
return
cb
(
error
)
this
.
_deps
.
fileManager
.
syncEditor
(
path
)
cb
()
})
}
else
{
cb
(
'file not found'
)
}
}
execute
(
file
,
cb
)
{
const
self
=
this
...
...
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