mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 17:56:45 +08:00
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:
@ -26,6 +26,7 @@ type Term struct {
|
||||
line *liner.State
|
||||
conf *config.Config
|
||||
dumb bool
|
||||
InitFile string
|
||||
}
|
||||
|
||||
func New(client service.Client, conf *config.Config) *Term {
|
||||
@ -85,6 +86,13 @@ func (t *Term) Run() (error, int) {
|
||||
f.Close()
|
||||
fmt.Println("Type 'help' for list of commands.")
|
||||
|
||||
if t.InitFile != "" {
|
||||
err := cmds.executeFile(t, t.InitFile)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error executing init file: %s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
var status int
|
||||
for {
|
||||
cmdstr, err := t.promptForInput()
|
||||
|
||||
Reference in New Issue
Block a user