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