feat: support cd - (#2693)
* feat: support `cd -` * docs: add documentation * docs: update `CHANGELOG.md`
This commit is contained in:
1 parent
1f31d6634e
commit
20c85c9477
5 files changed
+18
-3
No files matched your search
@@ -989,13 +989,20 @@ func insert(app *app, arg string) {
|
||||
}
|
||||
|
||||
func cd(app *app, path string) error {
|
||||
wd := app.nav.currDir().path
|
||||
if path == "-" {
|
||||
prev, ok := app.nav.marks["'"]
|
||||
if !ok {
|
||||
return errors.New("no previous directory")
|
||||
}
|
||||
path = prev
|
||||
}
|
||||
|
||||
path, err := filepath.Abs(replaceTilde(path))
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting absolute path: %w", err)
|
||||
}
|
||||
|
||||
wd := app.nav.currDir().path
|
||||
if path == wd {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user