aboutsummaryrefslogtreecommitdiff
path: root/commands/pwd.go
diff options
context:
space:
mode:
authorAmin Bandali <bandali@gnu.org>2019-05-19 14:00:02 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-19 14:36:11 -0400
commit588a6c785b29e6f2f97b7655101789be90bafafb (patch)
tree741054c21fc443af1daa6847ed4794b0aa18b4e3 /commands/pwd.go
parent248345d875e958b70f48797bfe6e822cc9485eb8 (diff)
Implement :pwd command
Diffstat (limited to 'commands/pwd.go')
-rw-r--r--commands/pwd.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/commands/pwd.go b/commands/pwd.go
new file mode 100644
index 0000000..b4f3eb1
--- /dev/null
+++ b/commands/pwd.go
@@ -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
+}