Implement :pwd command
This commit is contained in:
parent
248345d875
commit
588a6c785b
2 changed files with 28 additions and 0 deletions
25
commands/pwd.go
Normal file
25
commands/pwd.go
Normal file
|
@ -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
|
||||||
|
}
|
|
@ -25,6 +25,9 @@ These commands work in any context.
|
||||||
*cd* <directory>
|
*cd* <directory>
|
||||||
Changes aerc's current working directory.
|
Changes aerc's current working directory.
|
||||||
|
|
||||||
|
*pwd*
|
||||||
|
Displays aerc's current working directory in the status bar.
|
||||||
|
|
||||||
*term* [command...]
|
*term* [command...]
|
||||||
Opens a new terminal tab with a shell running in the current working
|
Opens a new terminal tab with a shell running in the current working
|
||||||
directory, or the specified command.
|
directory, or the specified command.
|
||||||
|
|
Loading…
Reference in a new issue