Skip to content

Instantly share code, notes, and snippets.

@idavis
Forked from bradwilson/Example Output (grouped)
Created November 8, 2012 21:19
Show Gist options
  • Save idavis/4041685 to your computer and use it in GitHub Desktop.
Save idavis/4041685 to your computer and use it in GitHub Desktop.
find-string.ps1: A PowerShell script to find strings
src\xunit\Sdk\Executor.cs
15: /// ExecutorWrapper instead.
src\xunit.runner.msbuild\Utility\XmlTestRunner.cs
8: public XmlTestRunner(IExecutorWrapper executorWrapper, IRunnerLogger logger)
10: testRunner = new TestRunner(executorWrapper, logger);
src\xunit.runner.msbuild\xunit.cs
98: using (ExecutorWrapper wrapper = new ExecutorWrapper(assemblyFilename, configFilename, ShadowCopy))
src\xunit.runner.msbuild\xunitproject.cs
48: using (ExecutorWrapper wrapper = new ExecutorWrapper(assembly.AssemblyFilename, assembly.ConfigFilename, assembly.ShadowCopy))
src\xunit.runner.tdnet\TdNetRunner.cs
51: using (ExecutorWrapper wrapper = new ExecutorWrapper(assemblyFilename, null, false))
68: using (ExecutorWrapper wrapper = new ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false))
94: using (ExecutorWrapper wrapper = new ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false))
src\xunit.runner.utility\TestObjectModel\MultiAssemblyTestEnvironment.cs
101: return Load(new ExecutorWrapper(assemblyFilename, configFilename, shadowCopy));
105: /// Adds the assembly loaded into the given <see cref="IExecutorWrapper"/>
108: /// <param name="executorWrapper">The executor wrapper.</param>
111: protected TestAssembly Load(IExecutorWrapper executorWrapper)
113: Guard.ArgumentNotNull("executorWrapper", executorWrapper);
115: TestAssembly testAssembly = TestAssemblyBuilder.Build(executorWrapper);
src\xunit\Sdk\Executor.cs:15: /// ExecutorWrapper instead.
src\xunit.runner.msbuild\Utility\XmlTestRunner.cs:8: public XmlTestRunner(IExecutorWrapper executorWrapper, IRunnerLogger logger)
src\xunit.runner.msbuild\Utility\XmlTestRunner.cs:10: testRunner = new TestRunner(executorWrapper, logger);
src\xunit.runner.msbuild\xunit.cs:98: using (ExecutorWrapper wrapper = new ExecutorWrapper(assemblyFilename, configFilename, ShadowCopy))
src\xunit.runner.msbuild\xunitproject.cs:48: using (ExecutorWrapper wrapper = new ExecutorWrapper(assembly.AssemblyFilename, assembly.ConfigFilename,
assembly.ShadowCopy))
src\xunit.runner.tdnet\TdNetRunner.cs:51: using (ExecutorWrapper wrapper = new ExecutorWrapper(assemblyFilename, null, false))
src\xunit.runner.tdnet\TdNetRunner.cs:68: using (ExecutorWrapper wrapper = new ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false))
src\xunit.runner.tdnet\TdNetRunner.cs:94: using (ExecutorWrapper wrapper = new ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false))
src\xunit.runner.utility\TestObjectModel\MultiAssemblyTestEnvironment.cs:101: return Load(new ExecutorWrapper(assemblyFilename, configFilename, shadowCopy));
src\xunit.runner.utility\TestObjectModel\MultiAssemblyTestEnvironment.cs:105: /// Adds the assembly loaded into the given <see cref="IExecutorWrapper"/>
src\xunit.runner.utility\TestObjectModel\MultiAssemblyTestEnvironment.cs:108: /// <param name="executorWrapper">The executor wrapper.</param>
src\xunit.runner.utility\TestObjectModel\MultiAssemblyTestEnvironment.cs:111: protected TestAssembly Load(IExecutorWrapper executorWrapper)
src\xunit.runner.utility\TestObjectModel\MultiAssemblyTestEnvironment.cs:113: Guard.ArgumentNotNull("executorWrapper", executorWrapper);
src\xunit.runner.utility\TestObjectModel\MultiAssemblyTestEnvironment.cs:115: TestAssembly testAssembly = TestAssemblyBuilder.Build(executorWrapper);
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:19: /// <param name="executorWrapper">The executor wrapper.</param>
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:21: public TestAssembly(IExecutorWrapper executorWrapper, IEnumerable<TestClass> testClasses)
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:23: Guard.ArgumentNotNull("executorWrapper", executorWrapper);
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:26: ExecutorWrapper = executorWrapper;
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:38: get { return ExecutorWrapper.AssemblyFilename; }
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:46: get { return ExecutorWrapper.ConfigFilename; }
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:52: public IExecutorWrapper ExecutorWrapper { get; private set; }
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:59: get { return ExecutorWrapper.XunitVersion; }
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:65: ExecutorWrapper.Dispose();
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:124: AddAttribute(assemblyNode, "name", ExecutorWrapper.AssemblyFilename);
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:127: if (ExecutorWrapper.ConfigFilename != null)
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:128: AddAttribute(assemblyNode, "configFile", ExecutorWrapper.ConfigFilename);
src\xunit.runner.utility\TestObjectModel\TestAssembly.cs:168: AddAttribute(assemblyNode, "test-framework", String.Format("xUnit.net {0}",
ExecutorWrapper.XunitVersion));
param(
[Parameter(Mandatory=$true)][string]$searchText,
[string]$filenamePattern = "*.*",
[switch]$grouped = $false
)
function Write-SearchLine {
process {
$line = $_.Line
if ($line.Length > 70) {
$line = $line.Substring(0, 67) + "..."
}
$index = $line.IndexOf($searchText);
$rhs = $line.substring($index);
$lhs = $line.substring(0,$index)
$rhs = $rhs.Replace($searchText,"")
Write-Host ($_.LineNumber.ToString().PadLeft(7) + ": ") -NoNewline
Write-Host $lhs -NoNewline
Write-Host $searchText -ForegroundColor Yellow -NoNewline
Write-Host $rhs
}
}
if ($grouped) {
$currentPath = resolve-path "."
get-childitem -r -i $filenamePattern | select-string $searchText | group-object Path | %{
write-host $_.Group[0].RelativePath($currentPath) -foregroundcolor Yellow
$_.Group | Write-SearchLine
}
}
else {
return get-childitem -r -i $filenamePattern | select-string $searchText | Write-SearchLine
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment