feat: support cd - (#2693)

* feat: support `cd -`

* docs: add documentation

* docs: update `CHANGELOG.md`
This commit is contained in:
CatsDeservePets authored and GitHub committed 2026-10-01 02:59:29 +02:00
1 parent 1f31d6634e
commit 20c85c9477
5 files changed
+18 -3

No files matched your search

+8 -1
View File
@@ -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
}