Store cwd in history
This commit is contained in:
parent
c8e8cb5ad5
commit
8574e136cd
@ -120,7 +120,8 @@ func exec_command(rl *readline.Readline, cmdline string) bool {
|
|||||||
if len(parsed_cmdline) == 0 {
|
if len(parsed_cmdline) == 0 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
hi := readline.HistoryItem{Timestamp: time.Now(), Cmd: cmdline, ExitCode: -1}
|
cwd, _ := os.Getwd()
|
||||||
|
hi := readline.HistoryItem{Timestamp: time.Now(), Cmd: cmdline, ExitCode: -1, Cwd: cwd}
|
||||||
switch parsed_cmdline[0] {
|
switch parsed_cmdline[0] {
|
||||||
case "exit":
|
case "exit":
|
||||||
hi.ExitCode = 0
|
hi.ExitCode = 0
|
||||||
|
|||||||
@ -16,8 +16,9 @@ var _ = fmt.Print
|
|||||||
|
|
||||||
type HistoryItem struct {
|
type HistoryItem struct {
|
||||||
Cmd string `json:"cmd"`
|
Cmd string `json:"cmd"`
|
||||||
|
Cwd string `json:"cwd,omitempty"`
|
||||||
Timestamp time.Time `json:"timestamp"`
|
Timestamp time.Time `json:"timestamp"`
|
||||||
Duration time.Duration `json:"duration"`
|
Duration time.Duration `json:"duration,omitempty"`
|
||||||
ExitCode int `json:"exit_code"`
|
ExitCode int `json:"exit_code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user