Skip to content

Commit

Permalink
Merge commit '04cf2070790933983c6c4e8ffa538b7a05ede61b'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gs-itisitcat committed Apr 14, 2024
2 parents f386c42 + 04cf207 commit b37c7c2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
11 changes: 4 additions & 7 deletions local-repository-listing/Searcher/ISearcher.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.ObjectModel;

namespace LocalRepositoryListing.Searcher;

namespace LocalRepositoryListing.Searcher;
/// <summary>
/// Represents a searcher that can search for repositories based on specified criteria.
/// </summary>
Expand All @@ -10,17 +7,17 @@ public interface ISearcher
/// <summary>
/// Gets the root directories to search in.
/// </summary>
public string[] RootDirectories { get; }
public IReadOnlyCollection<string> RootDirectories { get; }

/// <summary>
/// Gets the paths to exclude from the search.
/// </summary>
public ReadOnlyCollection<string> ExcludePaths { get; }
public IReadOnlyCollection<string> ExcludePaths { get; }

/// <summary>
/// Gets the directory names to exclude from the search.
/// </summary>
public ReadOnlyCollection<string> ExcludeNames { get; }
public IReadOnlyCollection<string> ExcludeNames { get; }

/// <summary>
/// Searches for repositories based on the specified criteria.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using Microsoft.Extensions.FileSystemGlobbing;
using Microsoft.Extensions.FileSystemGlobbing;

namespace LocalRepositoryListing.Searcher;

Expand All @@ -8,9 +7,9 @@ namespace LocalRepositoryListing.Searcher;
/// </summary>
public class NonRecursiveRepositorySearcher : ISearcher
{
public string[] RootDirectories { get; init; }
public ReadOnlyCollection<string> ExcludePaths { get; init; }
public ReadOnlyCollection<string> ExcludeNames { get; init; }
public IReadOnlyCollection<string> RootDirectories { get; init; }
public IReadOnlyCollection<string> ExcludePaths { get; init; }
public IReadOnlyCollection<string> ExcludeNames { get; init; }

private static readonly EnumerationOptions _enumerationOptions = new()
{
Expand All @@ -29,17 +28,17 @@ public class NonRecursiveRepositorySearcher : ISearcher
/// Initializes a new instance of the RepositorySearcher class with the specified root directories.
/// </summary>
/// <param name="rootDirectories">An array of root directories to search for repositories.</param>
public NonRecursiveRepositorySearcher(string[] rootDirectories) : this(rootDirectories, [], []) { }
public NonRecursiveRepositorySearcher(IList<string> rootDirectories) : this(rootDirectories, [], []) { }

/// <summary>
/// Initializes a new instance of the <see cref="NonRecursiveRepositorySearcher"/> class.
/// </summary>
/// <param name="rootDirectories">The root directories to search in.</param>
/// <param name="excludePaths">The paths to exclude from the search.</param>
/// <param name="excludeNames">The names to exclude from the search.</param>
public NonRecursiveRepositorySearcher(string[] rootDirectories, string[] excludePaths, string[] excludeNames)
public NonRecursiveRepositorySearcher(IList<string> rootDirectories, IList<string> excludePaths, IList<string> excludeNames)
{
RootDirectories = rootDirectories;
RootDirectories = rootDirectories.AsReadOnly();
ExcludePaths = excludePaths.AsReadOnly();
ExcludeNames = excludeNames.AsReadOnly();
_nameMatcher.AddIncludePatterns(excludeNames);
Expand Down
12 changes: 6 additions & 6 deletions local-repository-listing/Searcher/RecursiveRepositorySearcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public class RecursiveRepositorySearcher : ISearcher
{
private static readonly string _rootSearchPattern = "*";
private static readonly string _searchPattern = ".git";
public string[] RootDirectories { get; init; }
public ReadOnlyCollection<string> ExcludePaths { get; init; }
public ReadOnlyCollection<string> ExcludeNames { get; init; }
public IReadOnlyCollection<string> RootDirectories { get; init; }
public IReadOnlyCollection<string> ExcludePaths { get; init; }
public IReadOnlyCollection<string> ExcludeNames { get; init; }

private static readonly EnumerationOptions _rootEnumerationOptions = new()
{
Expand Down Expand Up @@ -64,17 +64,17 @@ private bool IsMatchExclude(DirectoryInfo directoryInfo)
/// Initializes a new instance of the RepositorySearcher class with the specified root directories.
/// </summary>
/// <param name="rootDirectories">An array of root directories to search for repositories.</param>
public RecursiveRepositorySearcher(string[] rootDirectories) : this(rootDirectories, [], []) { }
public RecursiveRepositorySearcher(IList<string> rootDirectories) : this(rootDirectories, [], []) { }

/// <summary>
/// Initializes a new instance of the <see cref="RecursiveRepositorySearcher"/> class.
/// </summary>
/// <param name="rootDirectories">The root directories to search in.</param>
/// <param name="excludePaths">The paths to exclude from the search.</param>
/// <param name="excludeNames">The names to exclude from the search.</param>
public RecursiveRepositorySearcher(string[] rootDirectories, string[] excludePaths, string[] excludeNames)
public RecursiveRepositorySearcher(IList<string> rootDirectories, IList<string> excludePaths, IList<string> excludeNames)
{
RootDirectories = rootDirectories;
RootDirectories = rootDirectories.AsReadOnly();
ExcludePaths = excludePaths.AsReadOnly();
ExcludeNames = excludeNames.AsReadOnly();
_nameMatcher.AddIncludePatterns(excludeNames);
Expand Down
2 changes: 1 addition & 1 deletion local-repository-listing/local-repository-listing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>lepol</AssemblyName>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<PublishSingleFile>true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract >true</IncludeNativeLibrariesForSelfExtract>
<DebugType>embedded</DebugType>
Expand Down

0 comments on commit b37c7c2

Please sign in to comment.