aboutsummaryrefslogtreecommitdiff
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
parent248345d875e958b70f48797bfe6e822cc9485eb8 (diff)
Implement :pwd command
-rw-r--r--commands/pwd.go25
-rw-r--r--doc/aerc.1.scd3
2 files changed, 28 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
+}
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index 5d501f0..e96334d 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -25,6 +25,9 @@ These commands work in any context.
*cd* <directory>
Changes aerc's current working directory.
+*pwd*
+ Displays aerc's current working directory in the status bar.
+
*term* [command...]
Opens a new terminal tab with a shell running in the current working
directory, or the specified command.