Add PathSearch component
- New PatchSearch component - Allow user to define base directory for search - Show (using single select list) search results - Allow user to define search string - Implement algorithms(start with exact-match and fuzzy-match) from fuzzy search tool (fzf) - Sample "component path search" and change "component path" to "component path input" - Fixes #556
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
// message
|
||||
message(model) ::= <%
|
||||
<if(model.message && model.hasMessageLevelError)>
|
||||
<({<figures.error>}); format="style-level-error"> <model.message; format="style-level-error">
|
||||
<elseif(model.message && model.hasMessageLevelWarn)>
|
||||
<({<figures.warning>}); format="style-level-warn"> <model.message; format="style-level-warn">
|
||||
<elseif(model.message && model.hasMessageLevelInfo)>
|
||||
<({<figures.info>}); format="style-level-info"> <model.message; format="style-level-info">
|
||||
<endif>
|
||||
%>
|
||||
|
||||
// info section after '? xxx'
|
||||
info(model) ::= <%
|
||||
<if(model.input)>
|
||||
<model.input>
|
||||
<endif>
|
||||
%>
|
||||
|
||||
// start '? xxx' shows both running and result
|
||||
question_name(model) ::= <<
|
||||
<({<figures.questionMark>}); format="style-list-value"> <model.name; format="style-title">
|
||||
>>
|
||||
|
||||
// render path item
|
||||
path_item(item,model) ::= <%
|
||||
<if(item.selected)>
|
||||
<({<figures.rightPointingQuotation> }); format="style-item-selector"><item.partsText; format={width:<model.terminalWidth>,prefix:2,textStyle:style-item-selector,matchStyle:style-level-warn}>
|
||||
<else>
|
||||
<(" ")><item.partsText; format={width:<model.terminalWidth>,prefix:2,textStyle:style-item-selector,matchStyle:style-level-warn}>
|
||||
<endif>
|
||||
%>
|
||||
|
||||
// render paths
|
||||
paths(model) ::= <<
|
||||
<model.pathViewItems:{x|<path_item(x,model)>}; separator="\n">
|
||||
>>
|
||||
|
||||
// component result
|
||||
result(model) ::= <<
|
||||
<question_name(model)> <model.resultValue; format="style-value">
|
||||
>>
|
||||
|
||||
// component is running
|
||||
running(model) ::= <<
|
||||
<question_name(model)> <info(model)>
|
||||
<message(model)>
|
||||
<paths(model)>
|
||||
>>
|
||||
|
||||
// main
|
||||
main(model) ::= <<
|
||||
<if(model.resultValue)><result(model)><else><running(model)><endif>
|
||||
>>
|
||||
Reference in New Issue
Block a user