aerc/commands/pwd.go

36 lines
556 B
Go
Raw Permalink Normal View History

2019-05-19 18:00:02 +00:00
package commands
import (
"errors"
"os"
"time"
2019-05-19 18:00:02 +00:00
"git.sr.ht/~rjarry/aerc/widgets"
2019-05-19 18:00:02 +00:00
)
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)
2019-05-19 18:00:02 +00:00
return nil
}