Renamed the command path to local.

This commit is contained in:
Alexandru Neamtu
2024-02-04 07:53:10 -05:00
parent 9354fb087f
commit 93794c2cc9
6 changed files with 25 additions and 25 deletions

View File

@@ -0,0 +1,17 @@
using Microsoft.Extensions.Logging;
using Velopack.Sources;
namespace Velopack.Deployment;
public class LocalDownloadOptions : RepositoryOptions
{
public DirectoryInfo Path { get; set; }
}
public class LocalRepository(ILogger logger) : SourceRepository<LocalDownloadOptions, SimpleFileSource>(logger)
{
public override SimpleFileSource CreateSource(LocalDownloadOptions options)
{
return new SimpleFileSource(options.Path);
}
}

View File

@@ -1,17 +0,0 @@
using Microsoft.Extensions.Logging;
using Velopack.Sources;
namespace Velopack.Deployment;
public class PathDownloadOptions : RepositoryOptions
{
public DirectoryInfo Path { get; set; }
}
public class PathRepository(ILogger logger) : SourceRepository<PathDownloadOptions, SimpleFileSource>(logger)
{
public override SimpleFileSource CreateSource(PathDownloadOptions options)
{
return new SimpleFileSource(options.Path);
}
}

View File

@@ -1,11 +1,11 @@
namespace Velopack.Vpk.Commands;
public class PathDownloadCommand : OutputCommand
public class LocalDownloadCommand : OutputCommand
{
public DirectoryInfo Path { get; private set; }
public PathDownloadCommand()
: base("path", "Download latest release from a specific path source.")
public LocalDownloadCommand()
: base("local", "Download latest release from a local path source.")
{
AddOption<DirectoryInfo>((p) => Path = p, "--path")
.SetDescription("Path to download releases from.")

View File

@@ -21,7 +21,7 @@ public static partial class OptionMapper
public static partial GitHubDownloadOptions ToOptions(this GitHubDownloadCommand cmd);
public static partial GitHubUploadOptions ToOptions(this GitHubUploadCommand cmd);
public static partial HttpDownloadOptions ToOptions(this HttpDownloadCommand cmd);
public static partial PathDownloadOptions ToOption(this PathDownloadCommand cmd);
public static partial LocalDownloadOptions ToOption(this LocalDownloadCommand cmd);
public static partial S3DownloadOptions ToOptions(this S3DownloadCommand cmd);
public static partial S3UploadOptions ToOptions(this S3UploadCommand cmd);
public static partial DeltaGenOptions ToOptions(this DeltaGenCommand cmd);

View File

@@ -83,7 +83,7 @@ public class Program
downloadCommand.AddRepositoryDownload<GitHubDownloadCommand, GitHubRepository, GitHubDownloadOptions>(provider);
downloadCommand.AddRepositoryDownload<S3DownloadCommand, S3Repository, S3DownloadOptions>(provider);
downloadCommand.AddRepositoryDownload<HttpDownloadCommand, HttpRepository, HttpDownloadOptions>(provider);
downloadCommand.AddRepositoryDownload<PathDownloadCommand, PathRepository, PathDownloadOptions>(provider);
downloadCommand.AddRepositoryDownload<LocalDownloadCommand, LocalRepository, LocalDownloadOptions>(provider);
rootCommand.Add(downloadCommand);
var uploadCommand = new CliCommand("upload", "Upload local package(s) to a remote update source.");

View File

@@ -2,12 +2,12 @@
using Velopack.Vpk.Commands;
namespace Velopack.CommandLine.Tests.Commands;
public class PathDownloadCommandTests : BaseCommandTests<PathDownloadCommand>
public class LocalDownloadCommandTests : BaseCommandTests<LocalDownloadCommand>
{
[Fact]
public void Path_WithPath_ParsesValue()
{
var command = new PathDownloadCommand();
var command = new LocalDownloadCommand();
DirectoryInfo directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "releases"));
ParseResult parseResult = command.ParseAndApply($"--path {directory.FullName}");
@@ -21,7 +21,7 @@ public class PathDownloadCommandTests : BaseCommandTests<PathDownloadCommand>
[Fact]
public void Path_WithNonExistingDirectory_ShowsError()
{
var command = new PathDownloadCommand();
var command = new LocalDownloadCommand();
// Parse with a fake path
ParseResult parseResult = command.ParseAndApply($"--path \"E:\releases\"");