From 53121860f125ce0dcb09a0be2ac22559f1eb1d05 Mon Sep 17 00:00:00 2001 From: Josh Medeski Date: Thu, 5 Sep 2024 19:45:58 -0500 Subject: [PATCH] feat: adding --hide-attached flag to list --- lister/list.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lister/list.go b/lister/list.go index 1891342..e38675c 100644 --- a/lister/list.go +++ b/lister/list.go @@ -34,9 +34,16 @@ func (l *RealLister) List(opts ListOptions) (model.SeshSessions, error) { return model.SeshSessions{}, err } fullOrderedIndex = append(fullOrderedIndex, sessions.OrderedIndex...) + filteredIndex := fullOrderedIndex[:0] // Create a slice with the same underlying array but length 0 for _, i := range sessions.OrderedIndex { + if opts.HideAttached && sessions.Directory[i].Attached == 1 { + // TODO: remove the item from the fullOrderedIndex + continue + } + filteredIndex = append(filteredIndex, i) fullDirectory[i] = sessions.Directory[i] } + fullOrderedIndex = filteredIndex } return model.SeshSessions{