package find include FindForm.feather include FindBehaviour.feather include FindRow.feather /** A GUI wrapper around command line tools `find` and `grep`. Looks for `FindInfo.searchText` within the filename of files/folder within a folder, recursively looking in subfolders to a max depth given by `FindInfo.maxDepth` Note, the file extension IS matchable, but the file/folders parent folders are NOT matchable. i.e. If we search for "foo" Then the file : ./food/grapes is NOT found. But the file : ./grapes.food IS found. This is work-in-progress. Eventually, I would like a form, where the user can fill in their search needs. But for now, I'm using a simple "prompt" Dialog, where only the `searchText` can be entered. Create a [FindInfo], alter options as needed. Then call Find.createTan( FindInfo ).openTab() Default options (on FindInfo) : maxDepth = 10 includeFiles = true includeLinks = true includeFolders = true useRegex = false caseSensitive = false */ class Find : SimpleComponent() { // ==== Register ==== override meth register() { val forFolder = SimpleFeatureSet( Context.FOLDER ).apply { val find = ContextAction( contextType, "Find", ::findAction ) .icon("search") menus( MenuFeature( "Folder", contextMenu() ) ) contextMenu( find ) } add( forFolder ) } // ==== Actions ==== func findAction( context : Context ) { FindForm( context.value as File, "" ).promptInNewTab() } // ==== API ==== func find( folder : File, searchText : String ) { FindForm( folder, searchText ).openBehaviour() } }