@@ -142,6 +142,12 @@ def convert(self, value, param, ctx):
142142 return value
143143
144144
145+ class GTComparisonType (ComparisonType ):
146+ """Only support gt or gte comparison"""
147+ valid = ['gt' , 'gte' ]
148+ help = 'COMP can be gt, or gte.'
149+
150+
145151class DateTimeType (click .ParamType ):
146152 name = 'datetime'
147153 help = 'DATETIME can be an RFC 3339 or ISO 8601 string.'
@@ -183,6 +189,22 @@ def convert(self, value, param, ctx):
183189 return data_filter .range_filter (** kwargs )
184190
185191
192+ class UpdateFilter (click .Tuple ):
193+ help = ('Filter to items with changes to a specified field value made ' +
194+ 'after a specified date.' +
195+ f'{ FieldType .help } { GTComparisonType .help } { DateTimeType .help } ' )
196+
197+ def __init__ (self ) -> None :
198+ super ().__init__ ([FieldType (), GTComparisonType (), DateTimeType ()])
199+
200+ def convert (self , value , param , ctx ):
201+ vals = super ().convert (value , param , ctx )
202+
203+ field , comp , value = vals
204+ kwargs = {'field_name' : field , comp : value }
205+ return data_filter .update_filter (** kwargs )
206+
207+
186208@data .command ()
187209@click .pass_context
188210@translate_exceptions
@@ -201,16 +223,28 @@ def convert(self, value, param, ctx):
201223 default = None ,
202224 callback = geom_to_filter ,
203225 help = 'Filter to items that overlap a given geometry.' )
226+ # @click.option('--number-in',
227+ # type=RangeFilter(),
228+ # multiple=True,
229+ # help=RangeFilter.help)
204230@click .option ('--range' ,
205231 'nrange' ,
206232 type = RangeFilter (),
207233 multiple = True ,
208234 help = RangeFilter .help )
235+ # @click.option('--string-in',
236+ # type=RangeFilter(),
237+ # multiple=True,
238+ # help=RangeFilter.help)
239+ @click .option ('--update' ,
240+ type = UpdateFilter (),
241+ multiple = True ,
242+ help = UpdateFilter .help )
209243@click .option ('--permission' ,
210244 type = bool ,
211245 default = True ,
212246 help = 'Filter to assets with download permissions.' )
213- def filter (ctx , asset , date_range , geom , nrange , permission , pretty ):
247+ def filter (ctx , asset , date_range , geom , nrange , update , permission , pretty ):
214248 """Create a structured item search filter.
215249
216250 This command provides basic functionality for specifying a filter by
@@ -223,7 +257,7 @@ def filter(ctx, asset, date_range, geom, nrange, permission, pretty):
223257
224258 # options allowing multiples are broken up so one filter is created for
225259 # each time the option is specified
226- filter_args = (asset , * date_range , geom , * nrange , permission )
260+ filter_args = (asset , * date_range , geom , * nrange , * update , permission )
227261
228262 filters = [f for f in filter_args if f ]
229263
0 commit comments