diff --git a/src/ModuleCore/Git/GitManager.cs b/src/ModuleCore/Git/GitManager.cs index fe1f69e..ce03922 100644 --- a/src/ModuleCore/Git/GitManager.cs +++ b/src/ModuleCore/Git/GitManager.cs @@ -52,4 +52,15 @@ public class GitManager throw new Exception($"Git repo already registered with the name {registrationName}"); } + + public List 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; } } \ No newline at end of file diff --git a/src/PowershellModule/Git/Commands/GetGitRepoCommand.cs b/src/PowershellModule/Git/Commands/GetGitRepoCommand.cs new file mode 100644 index 0000000..c1a4cb6 --- /dev/null +++ b/src/PowershellModule/Git/Commands/GetGitRepoCommand.cs @@ -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(); + } +} \ No newline at end of file