aerc/commands/pwd.go

36 lines
558 B
Go
Raw Normal View History

2019-05-19 18:00:02 +00:00
package commands
import (
"errors"
"os"
"time"
"git.sr.ht/~sircmpwn/aerc/widgets"
)
type PrintWorkDir struct{}
2019-05-19 18:00:02 +00:00
func init() {
register(PrintWorkDir{})
}
func (PrintWorkDir) Aliases() []string {
return []string{"pwd"}
}
func (PrintWorkDir) Complete(aerc *widgets.Aerc, args []string) []string {
return nil
2019-05-19 18:00:02 +00:00
}
func (PrintWorkDir) Execute(aerc *widgets.Aerc, args []string) error {
2019-05-19 18:00:02 +00:00
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
}