mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-21 00:30:00 +02:00
Record current directory on switch
This commit is contained in:
committed by
Jesse Duffield
parent
950bb5090d
commit
b8fc829f86
@ -11,16 +11,18 @@ import (
|
||||
// shell can then change to that directory. That means you don't get kicked
|
||||
// back to the directory that you started with.
|
||||
func (gui *Gui) recordCurrentDirectory() error {
|
||||
if os.Getenv("LAZYGIT_NEW_DIR_FILE") == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
// determine current directory, set it in LAZYGIT_NEW_DIR_FILE
|
||||
dirName, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return gui.recordDirectory(dirName)
|
||||
}
|
||||
|
||||
func (gui *Gui) recordDirectory(dirName string) error {
|
||||
if os.Getenv("LAZYGIT_NEW_DIR_FILE") == "" {
|
||||
return nil
|
||||
}
|
||||
return gui.OSCommand.CreateFileWithContent(os.Getenv("LAZYGIT_NEW_DIR_FILE"), dirName)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user