Skip to content

Commit

Permalink
Fix issue #116: migrate to dotnet 9 and use new features if applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Dec 14, 2024
1 parent e3abb27 commit f93789d
Show file tree
Hide file tree
Showing 4 changed files with 1,918 additions and 35 deletions.
11 changes: 3 additions & 8 deletions src/ImageIdentifierAndTagEvaluator.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
namespace port;

internal class ImageIdentifierAndTagEvaluator : IImageIdentifierAndTagEvaluator
internal class ImageIdentifierAndTagEvaluator(port.Config.Config config) : IImageIdentifierAndTagEvaluator
{
private readonly port.Config.Config _config;

public ImageIdentifierAndTagEvaluator(port.Config.Config config)
{
_config = config;
}
private readonly port.Config.Config _config = config;

public (string identifier, string tag) Evaluate(string imageIdentifier)
{
Expand All @@ -24,4 +19,4 @@ public ImageIdentifierAndTagEvaluator(port.Config.Config config)

return (imageConfig.Identifier, imageConfig.ImageTags.Single());
}
}
}
43 changes: 17 additions & 26 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,16 @@
app.Configure(appConfig =>
{
appConfig.UseAssemblyInformationalVersion();
appConfig.AddCommand<PullCliCommand>("pull")
.WithAlias("p");
appConfig.AddCommand<RunCliCommand>("run")
.WithAlias("r");
appConfig.AddCommand<ResetCliCommand>("reset")
.WithAlias("rs");
appConfig.AddCommand<CommitCliCommand>("commit")
.WithAlias("c");
appConfig.AddCommand<ListCliCommand>("list")
.WithAlias("ls");
appConfig.AddCommand<RemoveCliCommand>("remove")
.WithAlias("rm");
appConfig.AddCommand<PruneCliCommand>("prune")
.WithAlias("pr");
appConfig.AddCommand<StopCliCommand>("stop")
.WithAlias("s");
appConfig.AddCommand<ConfigCliCommand>("config")
.WithAlias("cfg");

appConfig.AddCommand<PullCliCommand>("pull").WithAlias("p");
appConfig.AddCommand<RunCliCommand>("run").WithAlias("r");
appConfig.AddCommand<ResetCliCommand>("reset").WithAlias("rs");
appConfig.AddCommand<CommitCliCommand>("commit").WithAlias("c");
appConfig.AddCommand<ListCliCommand>("list").WithAlias("ls");
appConfig.AddCommand<RemoveCliCommand>("remove").WithAlias("rm");
appConfig.AddCommand<PruneCliCommand>("prune").WithAlias("pr");
appConfig.AddCommand<StopCliCommand>("stop").WithAlias("s");
appConfig.AddCommand<ConfigCliCommand>("config").WithAlias("cfg");
});

AnsiConsole.Console = new CustomConsole();
Expand All @@ -87,16 +79,15 @@
{
config.SetExceptionHandler((exception, _) =>
{
switch (exception)
if (exception is TimeoutException)
{
case TimeoutException:
AnsiConsole.MarkupLine("[red]Timeout exception occurred[/], is the Docker daemon running?");
return -1;
default:
AnsiConsole.WriteException(exception, ExceptionFormats.ShortenEverything);
return -1;
AnsiConsole.MarkupLine("[red]Timeout exception occurred[/], is the Docker daemon running?");
return -1;
}

AnsiConsole.WriteException(exception, ExceptionFormats.ShortenEverything);
return -1;
});
});

return app.Run(args);
return app.Run(args);
Loading

0 comments on commit f93789d

Please sign in to comment.