Skip to content

Commit 2e65238

Browse files
author
Staffan Gustafsson
committed
Adding -global switch and defaulting to search below current directory
1 parent 1cccc51 commit 2e65238

5 files changed

Lines changed: 99 additions & 28 deletions

File tree

PSEverything/PSEverything.csproj

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,35 @@
4747
<Compile Include="SearchEverythingCommand.cs" />
4848
</ItemGroup>
4949
<ItemGroup>
50-
<Content Include="PSEverything.dll-Help.xml" />
50+
<Content Include="PSEverything.dll-Help.xml">
51+
<SubType>Designer</SubType>
52+
</Content>
5153
</ItemGroup>
5254
<ItemGroup>
53-
<None Include="PSEverything.psd1" />
55+
<Content Include="PSEverything.psd1" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<Content Include="..\LICENSE">
59+
<Link>LICENSE</Link>
60+
</Content>
5461
</ItemGroup>
5562
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
5663
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
5764
Other similar extension points exist, see Microsoft.Common.targets.
5865
<Target Name="BeforeBuild">
5966
</Target>
67+
68+
-->
6069
<Target Name="AfterBuild">
70+
<ItemGroup>
71+
<ModuleFiles Include="$(TargetPath)" />
72+
<ModuleFiles Include="@(Content)" />
73+
<ModuleFiles Include="dll\Everything*.dll" />
74+
</ItemGroup>
75+
<PropertyGroup>
76+
<ModuleDir>$(TargetDir)\PSEverything</ModuleDir>
77+
</PropertyGroup>
78+
<MakeDir Directories="$(ModuleDir)" />
79+
<Copy SourceFiles="@(ModuleFiles)" DestinationFolder="$(ModuleDir)" SkipUnchangedFiles="true" />
6180
</Target>
62-
-->
6381
</Project>

PSEverything/PSEverything.dll-Help.xml

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<helpItems xmlns="http://msh" schema="maml">
33
<!-- Edited with: SAPIEN PowerShell HelpWriter 2015 v1.0.10-->
44
<!-- Generated by: SAPIEN PowerShell HelpWriter 2015 v1.0.10-->
@@ -19,7 +19,9 @@
1919
</command:details>
2020
<maml:description>
2121
<maml:para>Search-Everyting Uses the Everything search engine from voidtools to perform near instant system wide searches of NTFS f
22-
ile systems.</maml:para>
22+
ile systems.
23+
24+
By default, Search-Everything limits the results to items below the current directory. Use the -Global switch to perform system wide searches.</maml:para>
2325
</maml:description>
2426
<command:syntax>
2527
<!-- Parameter Sets-->
@@ -33,10 +35,10 @@ ile systems.</maml:para>
3335
<command:parameterValue required="false" variableLength="false">String[]</command:parameterValue>
3436
</command:parameter>
3537
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
36-
<maml:name>QueryFilter</maml:name>
38+
<maml:name>Filter</maml:name>
3739
<maml:description>
3840
<maml:para>Search filter in native &#39;Everything&#39; syntax.
39-
41+
See http://www.voidtools.com/support/everything/searching/ for more info.
4042
Passed as-is to the search engine.
4143

4244
The search language that can be used is as follows:
@@ -170,6 +172,7 @@ Attribute Constants:
170172
V Device</maml:para>
171173
</maml:description>
172174
<command:parameterValue required="false" variableLength="false">String</command:parameterValue>
175+
<dev:defaultValue/>
173176
</command:parameter>
174177
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
175178
<maml:name>Exclude</maml:name>
@@ -185,33 +188,37 @@ Attribute Constants:
185188
</maml:description>
186189
<command:parameterValue required="false" variableLength="false">String[]</command:parameterValue>
187190
</command:parameter>
188-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
191+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="pi">
189192
<maml:name>PathInclude</maml:name>
190193
<maml:description>
191194
<maml:para>Specifies the filter for for paths to include</maml:para>
192195
</maml:description>
193196
<command:parameterValue required="false" variableLength="false">String[]</command:parameterValue>
197+
<dev:defaultValue/>
194198
</command:parameter>
195-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
199+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="pe">
196200
<maml:name>PathExclude</maml:name>
197201
<maml:description>
198202
<maml:para>Specifies the filter for for paths to exclude</maml:para>
199203
</maml:description>
200204
<command:parameterValue required="false" variableLength="false">String[]</command:parameterValue>
205+
<dev:defaultValue/>
201206
</command:parameter>
202-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
207+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="fi">
203208
<maml:name>FolderInclude</maml:name>
204209
<maml:description>
205210
<maml:para>Specifies the filter for for folders to include</maml:para>
206211
</maml:description>
207212
<command:parameterValue required="false" variableLength="false">String[]</command:parameterValue>
213+
<dev:defaultValue/>
208214
</command:parameter>
209-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
215+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="fe">
210216
<maml:name>FolderExclude</maml:name>
211217
<maml:description>
212218
<maml:para>Specifies the filter for for folders to exclude</maml:para>
213219
</maml:description>
214220
<command:parameterValue required="false" variableLength="false">String[]</command:parameterValue>
221+
<dev:defaultValue/>
215222
</command:parameter>
216223
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
217224
<maml:name>ParentCount</maml:name>
@@ -254,6 +261,15 @@ Attribute Constants:
254261
</maml:description>
255262
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
256263
</command:parameter>
264+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
265+
<maml:name>Global</maml:name>
266+
<maml:description>
267+
<maml:para>Performs a global search, not limited by the current directory.
268+
</maml:para>
269+
</maml:description>
270+
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
271+
<dev:defaultValue/>
272+
</command:parameter>
257273
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
258274
<maml:name>MatchWholeWord</maml:name>
259275
<maml:description>
@@ -318,6 +334,15 @@ $ Matches the end of the filename
318334
</maml:description>
319335
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
320336
</command:parameter>
337+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
338+
<maml:name>Global</maml:name>
339+
<maml:description>
340+
<maml:para>Performs a global search, not limited by the current directory.
341+
</maml:para>
342+
</maml:description>
343+
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
344+
<dev:defaultValue/>
345+
</command:parameter>
321346
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
322347
<maml:name>IncludeTotalCount</maml:name>
323348
<maml:description>
@@ -344,8 +369,8 @@ followed by the results.</maml:para>
344369
</command:syntax>
345370
<command:parameters>
346371
<!-- All Parameters-->
347-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
348-
<maml:name>QueryFilter</maml:name>
372+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
373+
<maml:name>Filter</maml:name>
349374
<maml:description>
350375
<maml:para>Search filter in native &#39;Everything&#39; syntax.
351376

@@ -524,7 +549,7 @@ Attribute Constants:
524549
</dev:type>
525550
<dev:defaultValue/>
526551
</command:parameter>
527-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
552+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="pi">
528553
<maml:name>PathInclude</maml:name>
529554
<maml:description>
530555
<maml:para>Specifies the filter for for paths to include</maml:para>
@@ -536,7 +561,7 @@ Attribute Constants:
536561
</dev:type>
537562
<dev:defaultValue/>
538563
</command:parameter>
539-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
564+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="pe">
540565
<maml:name>PathExclude</maml:name>
541566
<maml:description>
542567
<maml:para>Specifies the filter for for paths to exclude</maml:para>
@@ -548,7 +573,7 @@ Attribute Constants:
548573
</dev:type>
549574
<dev:defaultValue/>
550575
</command:parameter>
551-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
576+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="fi">
552577
<maml:name>FolderInclude</maml:name>
553578
<maml:description>
554579
<maml:para>Specifies the filter for for folders to include</maml:para>
@@ -560,7 +585,7 @@ Attribute Constants:
560585
</dev:type>
561586
<dev:defaultValue/>
562587
</command:parameter>
563-
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
588+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="fe">
564589
<maml:name>FolderExclude</maml:name>
565590
<maml:description>
566591
<maml:para>Specifies the filter for for folders to exclude</maml:para>
@@ -638,6 +663,19 @@ Attribute Constants:
638663
</dev:type>
639664
<dev:defaultValue/>
640665
</command:parameter>
666+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named" aliases="">
667+
<maml:name>Global</maml:name>
668+
<maml:description>
669+
<maml:para>Performs a global search, not limited by the current directory.
670+
</maml:para>
671+
</maml:description>
672+
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
673+
<dev:type>
674+
<maml:name>SwitchParameter</maml:name>
675+
<maml:uri/>
676+
</dev:type>
677+
<dev:defaultValue/>
678+
</command:parameter>
641679
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
642680
<maml:name>MatchWholeWord</maml:name>
643681
<maml:description>

PSEverything/PSEverything.psd1

0 Bytes
Binary file not shown.

PSEverything/Properties/AssemblyInfo.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following
65
// set of attributes. Change these attribute values to modify the information
76
// associated with an assembly.
87
[assembly: AssemblyTitle("PSEverything")]
9-
[assembly: AssemblyDescription("")]
10-
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
8+
[assembly: AssemblyDescription("Powershell frontent for voidtools PSEverything")]
9+
#if _DEBUG
10+
[assembly: AssemblyConfiguration("Debug")]
11+
#else
12+
[assembly: AssemblyConfiguration("Release")]
13+
#endif
14+
[assembly: AssemblyCompany("PowerCode Consulting AB")]
1215
[assembly: AssemblyProduct("PSEverything")]
1316
[assembly: AssemblyCopyright("Copyright © 2015")]
14-
[assembly: AssemblyTrademark("")]
1517
[assembly: AssemblyCulture("")]
1618

1719
// Setting ComVisible to false makes the types in this assembly not visible
@@ -33,4 +35,4 @@
3335
// by using the '*' as shown below:
3436
// [assembly: AssemblyVersion("1.0.*")]
3537
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.2.0.0")]
38+
[assembly: AssemblyFileVersion("1.3.0.0")]

PSEverything/SearchEverythingCommand.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace PSEverything
1111
public class SearchEverythingCommand : PSCmdlet
1212
{
1313
[Parameter(ParameterSetName = "default")]
14-
public string QueryFilter { get; set; }
14+
public string Filter { get; set; }
1515

1616
[Parameter(ParameterSetName = "default", Position = 1)]
1717
public string[] Include { get; set; }
@@ -22,15 +22,19 @@ public class SearchEverythingCommand : PSCmdlet
2222
[Parameter(ParameterSetName = "default")]
2323
public string[] Extension { get; set; }
2424

25+
[Alias("pi")]
2526
[Parameter(ParameterSetName = "default")]
2627
public string[] PathInclude { get; set; }
2728

29+
[Alias("pe")]
2830
[Parameter(ParameterSetName = "default")]
2931
public string[] PathExclude { get; set; }
3032

33+
[Alias("fi")]
3134
[Parameter(ParameterSetName = "default")]
3235
public string[] FolderInclude { get; set; }
3336

37+
[Alias("fe")]
3438
[Parameter(ParameterSetName = "default")]
3539
public string[] FolderExclude { get; set; }
3640

@@ -53,7 +57,10 @@ public class SearchEverythingCommand : PSCmdlet
5357

5458
[Parameter]
5559
public SwitchParameter CaseSensitive { get; set; }
56-
60+
61+
[Parameter]
62+
public SwitchParameter Global { get; set; }
63+
5764
[Parameter(ParameterSetName = "default")]
5865
public SwitchParameter MatchWholeWord { get; set; }
5966

@@ -76,9 +83,9 @@ private string GetSearchString()
7683

7784
private void AddPatternFilter(StringBuilder searchBuilder)
7885
{
79-
if (!String.IsNullOrEmpty(QueryFilter))
86+
if (!String.IsNullOrEmpty(Filter))
8087
{
81-
searchBuilder.Append(QueryFilter);
88+
searchBuilder.Append(Filter);
8289
}
8390
}
8491

@@ -111,7 +118,13 @@ private static void AddListFilter(StringBuilder searchBuilder, string filterName
111118

112119
private void AddPathFilter(StringBuilder searchBuilder)
113120
{
114-
AddListFilter(searchBuilder, "path:", PathInclude, PathExclude);
121+
AddListFilter(searchBuilder, "path:", PathInclude, PathExclude);
122+
if (!Global)
123+
{
124+
searchBuilder.Append(" path:");
125+
searchBuilder.Append(SessionState.Path.CurrentFileSystemLocation.ProviderPath);
126+
searchBuilder.Append('\\');
127+
}
115128
}
116129

117130
void AddFileFilter(StringBuilder searchBuilder)

0 commit comments

Comments
 (0)