Sometimes it might be useful to know the version of the running
instance. This is currently possible with templates (`:echo {{version}}`
does the trick), but it seems clearer to have a dedicated command.
Implement such command.
Changelog-added: A new :version command shows the version of the running instance of aerc in the statusbar.
Signed-off-by: inwit <inwit@sindominio.net>
---
v2: added changelog
commands/version.go | 32 ++++++++++++++++++++++++++++++++
doc/aerc.1.scd | 3 +++
2 files changed, 35 insertions(+)
create mode 100644 commands/version.go
diff --git a/commands/version.go b/commands/version.go
new file mode 100644
index 00000000..fb177120
--- /dev/null
+++ b/commands/version.go
@@ -0,0 +1,32 @@
+package commands
+
+import (
+ "fmt"
+ "time"
+
+ "git.sr.ht/~rjarry/aerc/app"
+ "git.sr.ht/~rjarry/aerc/lib/log"
+)
+
+type Version struct{}
+
+func init() {
+ Register(Version{})
+}
+
+func (Version) Description() string {
+ return "Display the version of the running aerc instance."
+}
+
+func (Version) Context() CommandContext {
+ return GLOBAL
+}
+
+func (Version) Aliases() []string {
+ return []string{"version"}
+}
+
+func (p Version) Execute(args []string) error {
+ app.PushStatus(fmt.Sprint("aerc "+log.BuildInfo), 20*time.Second)
+ return nil
+}
diff --git a/doc/aerc.1.scd b/doc/aerc.1.scd
index 595a94af..b01dee75 100644
--- a/doc/aerc.1.scd
+++ b/doc/aerc.1.scd
@@ -171,6 +171,9 @@ These commands work in any context.
*:pwd*
Displays aerc's current working directory in the status bar.
+*:version*
+ Displays the version of the running aerc instance.
+
*:send-keys* _<keystrokes>_
Send keystrokes to the currently visible terminal, if any. Can be used to
control embedded editors to save drafts or quit in a safe manner.
--
2.47.2
Inwit <inwit@sindominio.net> wrote:
> Sometimes it might be useful to know the version of the running
> instance. This is currently possible with templates (`:echo {{version}}`
> does the trick), but it seems clearer to have a dedicated command.
> Implement such command.
>
> Changelog-added: A new :version command shows the version of the running instance of aerc in the statusbar.
> Signed-off-by: inwit <inwit@sindominio.net>
> ---
> v2: added changelog
Acked-by: Robin Jarry <robin@jarry.cc>
Applied, thanks.
To git@git.sr.ht:~rjarry/aerc
932d9a44d50e..4c46306ead42 master -> master