Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
143f16e
fix: config would fail because no providers were configured (#129)
Dec 23, 2021
6cdf60d
chore: release 1.5.2 (#130)
github-actions[bot] Dec 23, 2021
44a0620
feat: async enumerable and lazy paging (#128)
Dec 24, 2021
20ebc69
chore: release 1.6.0 (#133)
github-actions[bot] Dec 24, 2021
b9caa76
feat: add sort keys to show help (#132)
Dec 26, 2021
8b782e5
chore: tests for some common model classes (#136)
Dec 31, 2021
9de2b55
feat: add initial filter impl (#137)
Dec 31, 2021
f90de83
chore: release 1.7.0 (#134)
github-actions[bot] Dec 31, 2021
fe138dd
fix: accept filter contents with embedded colons (like 'title:fix:') …
Dec 31, 2021
dbaf907
chore: release 1.7.1 (#140)
github-actions[bot] Dec 31, 2021
187f3d9
fix: during the changes to status fetching the rollup got lost along …
Jan 4, 2022
291ba6c
chore: release 1.7.2 (#142)
github-actions[bot] Jan 4, 2022
eb00ab0
fix: when a user is deleted the Author field isn't returned. replacin…
Jan 6, 2022
01f5d1f
chore: release 1.7.3 (#144)
github-actions[bot] Jan 6, 2022
8247867
fix: handle errors in show/watch (#147)
tshowers-bt Jan 26, 2022
15f65f2
feat: initial addition of loggers with some simple top level log stat…
Mar 30, 2022
f68e47b
chore: release 1.8.0 (#153)
github-actions[bot] Apr 8, 2022
6a8ee49
fix: Revert "feat: initial addition of loggers " (#154)
Insomniak47 Apr 8, 2022
650402d
chore: release 1.8.1 (#155)
github-actions[bot] Apr 8, 2022
60e923d
fix: registration was not living long enough to handle cancellation p…
Insomniak47 Apr 9, 2022
748d2f7
chore: release 1.8.2 (#157)
github-actions[bot] Apr 9, 2022
cdd9db4
feat: configurable show timeout (#160)
tshowers-bt May 6, 2022
84d884b
chore: release 1.9.0 (#162)
github-actions[bot] May 9, 2022
dd71f6f
fix: add docs for filter, cleanup sorting and other text (#164)
Insomniak47 Oct 8, 2022
4cb1d81
chore: release 1.9.1 (#165)
github-actions[bot] Oct 8, 2022
9d5f33b
feat: add config subcommands (and move to an app builder setup) (#166)
Insomniak47 Oct 23, 2022
c8e174a
chore: release 1.10.0 (#169)
github-actions[bot] Oct 23, 2022
8fea83b
feat: configurable configfile path (#171)
Insomniak47 Nov 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,95 @@
# Changelog

## [1.10.0](https://www.github.com/wareismymind/peer/compare/v1.9.1...v1.10.0) (2022-10-23)


### Features

* add config subcommands (and move to an app builder setup) ([#166](https://www.github.com/wareismymind/peer/issues/166)) ([9d5f33b](https://www.github.com/wareismymind/peer/commit/9d5f33ba7e9a8f8b21b4949db0d93ead75dd7774))

### [1.9.1](https://www.github.com/wareismymind/peer/compare/v1.9.0...v1.9.1) (2022-10-08)


### Bug Fixes

* add docs for filter, cleanup sorting and other text ([#164](https://www.github.com/wareismymind/peer/issues/164)) ([dd71f6f](https://www.github.com/wareismymind/peer/commit/dd71f6f8f7b7957f681131ab9f23cb70d71dc60b))

## [1.9.0](https://www.github.com/wareismymind/peer/compare/v1.8.2...v1.9.0) (2022-05-06)


### Features

* configurable show timeout ([#160](https://www.github.com/wareismymind/peer/issues/160)) ([cdd9db4](https://www.github.com/wareismymind/peer/commit/cdd9db4184e9226e6638059d6cd56862eb46cf14))

### [1.8.2](https://www.github.com/wareismymind/peer/compare/v1.8.1...v1.8.2) (2022-04-09)


### Bug Fixes

* registration was not living long enough to handle cancellation properly. Also flattened out some of the async enumerables ([#156](https://www.github.com/wareismymind/peer/issues/156)) ([60e923d](https://www.github.com/wareismymind/peer/commit/60e923d345b656f01381b9a8e288642513f4f145))

### [1.8.1](https://www.github.com/wareismymind/peer/compare/v1.8.0...v1.8.1) (2022-04-08)


### Bug Fixes

* Revert "feat: initial addition of loggers " ([#154](https://www.github.com/wareismymind/peer/issues/154)) ([6a8ee49](https://www.github.com/wareismymind/peer/commit/6a8ee49c58b911a86a218b98e228f841359b316e))

## [1.8.0](https://www.github.com/wareismymind/peer/compare/v1.7.3...v1.8.0) (2022-03-30)


### Features

* initial addition of loggers with some simple top level log statements (and one in show) until we figure out how we want to approach it ([#152](https://www.github.com/wareismymind/peer/issues/152)) ([15f65f2](https://www.github.com/wareismymind/peer/commit/15f65f231b72b06231aca7f937c0635e6ba95f91))


### Bug Fixes

* handle errors in show/watch ([#147](https://www.github.com/wareismymind/peer/issues/147)) ([8247867](https://www.github.com/wareismymind/peer/commit/824786781edf230f7e83032f59b0fe5aafcd567a))

### [1.7.3](https://www.github.com/wareismymind/peer/compare/v1.7.2...v1.7.3) (2022-01-06)


### Bug Fixes

* when a user is deleted the Author field isn't returned. replacing author with 'octoghost' in those cases ([#143](https://www.github.com/wareismymind/peer/issues/143)) ([eb00ab0](https://www.github.com/wareismymind/peer/commit/eb00ab0e3ea00411e973fc324b1d49a6445facfa))

### [1.7.2](https://www.github.com/wareismymind/peer/compare/v1.7.1...v1.7.2) (2022-01-04)


### Bug Fixes

* during the changes to status fetching the rollup got lost along the way ([#141](https://www.github.com/wareismymind/peer/issues/141)) ([187f3d9](https://www.github.com/wareismymind/peer/commit/187f3d9cf318aa49563370c65c1883cedc165975))

### [1.7.1](https://www.github.com/wareismymind/peer/compare/v1.7.0...v1.7.1) (2021-12-31)


### Bug Fixes

* accept filter contents with embedded colons (like 'title:fix:') ([#139](https://www.github.com/wareismymind/peer/issues/139)) ([fe138dd](https://www.github.com/wareismymind/peer/commit/fe138ddd22f259d4245e792e73dd3008583be47c))

## [1.7.0](https://www.github.com/wareismymind/peer/compare/v1.6.0...v1.7.0) (2021-12-31)


### Features

* add initial filter impl ([#137](https://www.github.com/wareismymind/peer/issues/137)) ([9de2b55](https://www.github.com/wareismymind/peer/commit/9de2b552cde8a412963008577f836c5b6df58ada))
* add sort keys to show help ([#132](https://www.github.com/wareismymind/peer/issues/132)) ([b9caa76](https://www.github.com/wareismymind/peer/commit/b9caa76108cf282d49ae3af7f546acd49fcc1c74))

## [1.6.0](https://www.github.com/wareismymind/peer/compare/v1.5.2...v1.6.0) (2021-12-24)


### Features

* async enumerable and lazy paging ([#128](https://www.github.com/wareismymind/peer/issues/128)) ([44a0620](https://www.github.com/wareismymind/peer/commit/44a062087bf98145fcc6b2221eaa34a89a26c430))

### [1.5.2](https://www.github.com/wareismymind/peer/compare/v1.5.1...v1.5.2) (2021-12-23)


### Bug Fixes

* config would fail because no providers were configured ([#129](https://www.github.com/wareismymind/peer/issues/129)) ([143f16e](https://www.github.com/wareismymind/peer/commit/143f16e9b49b752f425d0d1698ac0bf7fc865919))

### [1.5.1](https://www.github.com/wareismymind/peer/compare/v1.5.0...v1.5.1) (2021-12-19)


Expand Down
4 changes: 4 additions & 0 deletions Peer.Domain/Check.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Peer.Domain.Util;

namespace Peer.Domain
{
Expand All @@ -12,6 +13,9 @@ public class Check

public Check(string name, string? description, Uri url, CheckStatus status, CheckResult result)
{
Validators.ArgIsDefined(status);
Validators.ArgIsDefined(result);

Name = name ?? throw new ArgumentNullException(nameof(name));
Description = description;
Url = url ?? throw new ArgumentNullException(nameof(url));
Expand Down
48 changes: 0 additions & 48 deletions Peer.Domain/Commands/Config.cs

This file was deleted.

82 changes: 82 additions & 0 deletions Peer.Domain/Commands/ConfigEdit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Peer.Domain.Util;
using wimm.Secundatives;
using wimm.Secundatives.Extensions;

namespace Peer.Domain.Commands;

public class ConfigEdit
{
private readonly IOSInfoProvider _infoProvider;
private readonly ConfigEditConfig _config;
private readonly IFileOperations _fileOps;

public ConfigEdit(ConfigEditConfig config, IOSInfoProvider infoProvider, IFileOperations fileOps)
{
_config = config;
_infoProvider = infoProvider;
_fileOps = fileOps;
}

public Task<Result<None, ConfigEditError>> RunAsync()
{
return OpenFileAsync(_config.ConfigPath);
}

private async Task<Result<None, ConfigEditError>> OpenFileAsync(string path)
{
if (!_fileOps.Exists(path))
{
await using var _ = File.Create(path);
}

var proc = _config.Editor == null
? OpenWithOsDefault(path)
: OpenWithEditor(path);


if (proc.IsError)
{
return proc.Error;
}

await proc.Value!.WaitForExitAsync();
return Maybe.None;
}

private Result<Process, ConfigEditError> OpenWithEditor(string path)
{
var split = _config.Editor!.Split(' ').ToArray();
var os = _infoProvider.GetPlatform().OkOr(ConfigEditError.UnsupportedOs);

return os.Map(os =>
Process.Start(
new ProcessStartInfo
{
FileName = split[0],
Arguments = string.Join(' ', split.Skip(1).Append(path)),
UseShellExecute = os == OSPlatform.Windows
})
.ValueOr(ConfigEditError.ProcessFailedToOpen))
.Flatten();
}

private Result<Process, ConfigEditError> OpenWithOsDefault(string path)
{
//info(cn): See https://github.com/dotnet/runtime/issues/17938
return _infoProvider.GetPlatform()
.OkOr(ConfigEditError.UnsupportedOs)
.Map(
os => os switch
{
_ when os == OSPlatform.Windows => Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = path }).ValueOr(ConfigEditError.ProcessFailedToOpen),
_ when os == OSPlatform.OSX => Process.Start("open", path).ValueOr(ConfigEditError.ProcessFailedToOpen),
_ => new Result<Process, ConfigEditError>(ConfigEditError.UnsupportedOs)
})
.Flatten();
}
}
13 changes: 13 additions & 0 deletions Peer.Domain/Commands/ConfigEditConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Peer.Domain.Commands;

public class ConfigEditConfig
{
public string? Editor { get; }
public string ConfigPath { get; }

public ConfigEditConfig(string? editor, string configPath)
{
Editor = editor;
ConfigPath = configPath;
}
}
8 changes: 8 additions & 0 deletions Peer.Domain/Commands/ConfigEditError.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Peer.Domain.Commands;

public enum ConfigEditError
{
Fire,
UnsupportedOs,
ProcessFailedToOpen,
}
2 changes: 1 addition & 1 deletion Peer.Domain/Commands/Details.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Details(

public async Task<Result<None, FindError>> DetailsAsync(DetailsArguments args, CancellationToken token = default)
{
var findResult = await _prService.FindByPartial(args.Partial, token);
var findResult = await _prService.FindSingleByPartial(args.Partial, token);
var formatted = findResult.Map(pr => _formatter.Format(pr));

if (formatted.IsError)
Expand Down
13 changes: 10 additions & 3 deletions Peer.Domain/Commands/DetailsFormatter.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Peer.Domain.Util;
using wimm.Secundatives.Extensions;


namespace Peer.Domain.Commands
{
//TODO:CN -- Ansi term code support
Expand All @@ -20,6 +20,8 @@ public DetailsFormatter(ICheckSymbolProvider symbolProvider)

public IList<string> Format(PullRequest pullRequest)
{
Validators.ArgIsNotNull(pullRequest);

var lines = new List<string>
{
"---",
Expand All @@ -32,16 +34,21 @@ public IList<string> Format(PullRequest pullRequest)
lines.Add("Url:");
lines.Add($"{_pad}{pullRequest.Url}");
lines.Add(string.Empty);
lines.Add("Checks:");

if (!pullRequest.Checks.Any())
{
return lines;
}

lines.Add("Checks:");
var titleWidth = pullRequest.Checks.Max(x => x.Name.Length);

//Checks here
foreach (var check in pullRequest.Checks)
{
var symbol = _symbolProvider.GetSymbol(check.Status, check.Result)
.UnwrapOr("\u25EF\uFE0F"); //Large white circle

lines.Add($"{_pad}{symbol,4} {check.Name.PadRight(titleWidth)} -- {check.Url}");
}

Expand Down
13 changes: 0 additions & 13 deletions Peer.Domain/Commands/IPullRequestService.cs

This file was deleted.

3 changes: 2 additions & 1 deletion Peer.Domain/Commands/Open.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading;
using System.Threading.Tasks;
using Peer.Domain.Exceptions;
using Peer.Domain.Util;
using wimm.Secundatives;

namespace Peer.Domain.Commands
Expand All @@ -21,7 +22,7 @@ public Open(IPullRequestService prService, IOSInfoProvider infoProvider)

public async Task<Result<None, OpenError>> OpenAsync(OpenArguments openOptions, CancellationToken token = default)
{
var res = await _prService.FindByPartial(openOptions.Partial, token)
var res = await _prService.FindSingleByPartial(openOptions.Partial, token)
.MapError(err => err switch
{
FindError.AmbiguousMatch => OpenError.AmbiguousPattern,
Expand Down
Loading