Implement :pwd command

This commit is contained in:
Amin Bandali 2019-05-19 14:00:02 -04:00 committed by Drew DeVault
parent 248345d875
commit 588a6c785b
2 changed files with 28 additions and 0 deletions

25
commands/pwd.go Normal file
View file

@ -0,0 +1,25 @@
package commands
import (
"errors"
"os"
"time"
"git.sr.ht/~sircmpwn/aerc/widgets"
)
func init() {
register("pwd", PrintWorkDirectory)
}
func PrintWorkDirectory(aerc *widgets.Aerc, args []string) error {
if len(args) != 1 {
return errors.New("Usage: pwd")
}
pwd, err := os.Getwd()
if err != nil {
return err
}
aerc.PushStatus(pwd, 10*time.Second)
return nil
}

View file

@ -25,6 +25,9 @@ These commands work in any context.
*cd* <directory>
Changes aerc's current working directory.
*pwd*
Displays aerc's current working directory in the status bar.
*term* [command...]
Opens a new terminal tab with a shell running in the current working
directory, or the specified command.