feat(git-provider): Initial Get-GitRepo implementation
This commit is contained in:
parent
a0e29619a4
commit
af5c9e43b6
2 changed files with 30 additions and 0 deletions
|
|
@ -52,4 +52,15 @@ public class GitManager
|
|||
|
||||
throw new Exception($"Git repo already registered with the name {registrationName}");
|
||||
}
|
||||
|
||||
public List<GitReg> ListRepos()
|
||||
{
|
||||
return _registrations.Select(x => new GitReg() { Name = x.Value.Name, Location = x.Value.Location }).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public class GitReg
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public required string Location { get; set; }
|
||||
}
|
||||
19
src/PowershellModule/Git/Commands/GetGitRepoCommand.cs
Normal file
19
src/PowershellModule/Git/Commands/GetGitRepoCommand.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using System.Management.Automation;
|
||||
using ModuleCore.Git;
|
||||
|
||||
namespace PowershellModule.Git.Commands;
|
||||
|
||||
[Cmdlet(VerbsCommon.Get, Noun)]
|
||||
public class ListGitRepoCommand : PSCmdlet
|
||||
{
|
||||
private const string Noun = "GitRepo";
|
||||
|
||||
protected override void BeginProcessing()
|
||||
{
|
||||
var repos = GitManager.Instance.ListRepos();
|
||||
|
||||
WriteObject(repos);
|
||||
|
||||
base.BeginProcessing();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue