@@ -146,6 +146,7 @@ export function makeSelector<OtherOptions, Client, Page, Item, Id>({
146146 stdout = process . stderr ,
147147 style,
148148 clearFirst,
149+ filterItems = ( ) => true ,
149150 ...rest
150151 } : {
151152 client ?: Client
@@ -156,6 +157,7 @@ export function makeSelector<OtherOptions, Client, Page, Item, Id>({
156157 clearFirst ?: boolean
157158 stdin ?: Readable
158159 stdout ?: Writable
160+ filterItems ?: ( item : Item ) => boolean
159161 } & OtherOptions = { } as any
160162 ) : Promise < Item > => {
161163 const region = await ( client as any ) . config . region ( )
@@ -186,7 +188,7 @@ export function makeSelector<OtherOptions, Client, Page, Item, Id>({
186188 cancelationToken : CancelationToken ,
187189 yieldChoices : ( choices : Choices < Item > ) => void
188190 ) : Promise < Choices < Item > | void > => {
189- const choices : Choices < Item > = [ ]
191+ let choices : Choices < Item > = [ ]
190192
191193 if ( ! search && useRecents ) {
192194 choices . push (
@@ -227,6 +229,7 @@ export function makeSelector<OtherOptions, Client, Page, Item, Id>({
227229 title : createTitle ( item ) ,
228230 } )
229231 }
232+ choices = choices . filter ( ( c ) => filterItems ( c . value ) )
230233 if ( ! choices . length ) {
231234 choices . push ( {
232235 title : chalk . gray ( `No matching ${ things } found` ) ,
0 commit comments