Implement :pwd command

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

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
}