terminal: Implements init file and source command

The 'source' command reads the file specified as argument and executes
it as a list of delve commands.
Additionally a flag '--init' can be passed to delve specifying a file
containing a list of commands to execute on startup.

Issue #96
This commit is contained in:
aarzilli
2015-09-29 18:40:12 +02:00
committed by Derek Parker
parent bc9ac0ec78
commit eb2bc2a7ee
6 changed files with 107 additions and 7 deletions

View File

@ -23,10 +23,7 @@ type Fixture struct {
// Fixtures is a map of Fixture.Name to Fixture.
var Fixtures map[string]Fixture = make(map[string]Fixture)
func BuildFixture(name string) Fixture {
if f, ok := Fixtures[name]; ok {
return f
}
func FindFixturesDir() string {
parent := ".."
fixturesDir := "_fixtures"
for depth := 0; depth < 10; depth++ {
@ -35,6 +32,15 @@ func BuildFixture(name string) Fixture {
}
fixturesDir = filepath.Join(parent, fixturesDir)
}
return fixturesDir
}
func BuildFixture(name string) Fixture {
if f, ok := Fixtures[name]; ok {
return f
}
fixturesDir := FindFixturesDir()
// Make a (good enough) random temporary file name
r := make([]byte, 4)