diff options
author | Koni Marti <koni.marti@gmail.com> | 2023-11-18 02:04:01 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-11-23 00:14:54 +0100 |
commit | 30d28d0542997ad55a59439775929c63b2de8616 (patch) | |
tree | 20d52e73e1b97d76b9bde126c9dfc8a02e46d554 /commands | |
parent | 85d0936df6861c41a1dddd91a2f3b97afd8e127a (diff) | |
download | aerc-30d28d0542997ad55a59439775929c63b2de8616.tar.gz |
dirtree: add custom virtual directory role
Add a new directory role to indicate virtual nodes in the directory
tree. This allows to style the virtual nodes differently and apply
different behaviors in some commands (i.e. rmdir).
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/account/rmdir.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/commands/account/rmdir.go b/commands/account/rmdir.go index 6590a819..0793c7b8 100644 --- a/commands/account/rmdir.go +++ b/commands/account/rmdir.go @@ -5,6 +5,7 @@ import ( "time" "git.sr.ht/~rjarry/aerc/app" + "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -31,6 +32,12 @@ func (r RemoveDir) Execute(args []string) error { return errors.New("Refusing to remove non-empty directory; use -f") } + if d := acct.Directories().SelectedDirectory(); d != nil { + if d.Role == models.VirtualRole { + return errors.New("Cannot remove a virtual node") + } + } + curDir := acct.SelectedDirectory() var newDir string dirFound := false |