mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Re-organise vpk commands to sub folders
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class AzureBaseCommand : OutputCommand
|
||||
{
|
||||
@@ -26,38 +25,13 @@ public class AzureBaseCommand : OutputCommand
|
||||
|
||||
AddOption<string>((v) => ContainerName = v, "--container")
|
||||
.SetDescription("Azure container name")
|
||||
.SetArgumentHelpName("CONTAINER")
|
||||
.SetRequired();
|
||||
.SetArgumentHelpName("NAME")
|
||||
.SetRequired();
|
||||
|
||||
AddOption<Uri>((v) => Endpoint = v.ToAbsoluteOrNull(), "--endpoint")
|
||||
.SetDescription("Service url (eg. https://<storage-account-name>.blob.core.windows.net)")
|
||||
.SetArgumentHelpName("URL")
|
||||
.MustBeValidHttpUri()
|
||||
.SetRequired();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class AzureDownloadCommand : AzureBaseCommand
|
||||
{
|
||||
public AzureDownloadCommand()
|
||||
: base("az", "Download latest release from an AZ container.")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class AzureUploadCommand : AzureBaseCommand
|
||||
{
|
||||
public int KeepMaxReleases { get; private set; }
|
||||
|
||||
public AzureUploadCommand()
|
||||
: base("az", "Upload releases to an Azure container.")
|
||||
{
|
||||
AddOption<int>((x) => KeepMaxReleases = x, "--keepMaxReleases")
|
||||
.SetDescription("The maximum number of releases to keep in the bucket, anything older will be deleted.")
|
||||
.SetArgumentHelpName("COUNT");
|
||||
|
||||
ReleaseDirectoryOption.SetRequired();
|
||||
ReleaseDirectoryOption.MustNotBeEmpty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class AzureDownloadCommand : AzureBaseCommand
|
||||
{
|
||||
public AzureDownloadCommand()
|
||||
: base("az", "Download latest release from an Azure Blob Storage container.")
|
||||
{
|
||||
}
|
||||
}
|
||||
17
src/Velopack.Vpk/Commands/Deployment/AzureUploadCommand.cs
Normal file
17
src/Velopack.Vpk/Commands/Deployment/AzureUploadCommand.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class AzureUploadCommand : AzureBaseCommand
|
||||
{
|
||||
public int KeepMaxReleases { get; private set; }
|
||||
|
||||
public AzureUploadCommand()
|
||||
: base("az", "Upload releases to an Azure Blob Storage container.")
|
||||
{
|
||||
AddOption<int>((x) => KeepMaxReleases = x, "--keepMaxReleases")
|
||||
.SetDescription("The maximum number of releases to keep in the bucket, anything older will be deleted.")
|
||||
.SetArgumentHelpName("COUNT");
|
||||
|
||||
ReleaseDirectoryOption.SetRequired();
|
||||
ReleaseDirectoryOption.MustNotBeEmpty();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public abstract class GitHubBaseCommand : OutputCommand
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class GitHubDownloadCommand : GitHubBaseCommand
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class GitHubUploadCommand : GitHubBaseCommand
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class HttpDownloadCommand : OutputCommand
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class LocalDownloadCommand : OutputCommand
|
||||
{
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class S3BaseCommand : OutputCommand
|
||||
{
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class S3DownloadCommand : S3BaseCommand
|
||||
{
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
public class S3UploadCommand : S3BaseCommand
|
||||
{
|
||||
8
src/Velopack.Vpk/Commands/Flow/LoginCommand.cs
Normal file
8
src/Velopack.Vpk/Commands/Flow/LoginCommand.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
public class LoginCommand : VelopackServiceCommand
|
||||
{
|
||||
public LoginCommand()
|
||||
: base("login", "Login to Velopack Flow.")
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
using Velopack.Packaging.Abstractions;
|
||||
using Velopack.Packaging.Flow;
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
#nullable enable
|
||||
|
||||
public class LoginCommandRunner(IVelopackFlowServiceClient Client) : ICommand<LoginOptions>
|
||||
{
|
||||
|
||||
public async Task Run(LoginOptions options)
|
||||
{
|
||||
await Client.LoginAsync(new() {
|
||||
5
src/Velopack.Vpk/Commands/Flow/LoginOptions.cs
Normal file
5
src/Velopack.Vpk/Commands/Flow/LoginOptions.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using Velopack.Packaging.Flow;
|
||||
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
|
||||
public sealed class LoginOptions : VelopackServiceOptions;
|
||||
8
src/Velopack.Vpk/Commands/Flow/LogoutCommand.cs
Normal file
8
src/Velopack.Vpk/Commands/Flow/LogoutCommand.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
public class LogoutCommand : VelopackServiceCommand
|
||||
{
|
||||
public LogoutCommand()
|
||||
: base("logout", "Remove stored credentials for Velopack Flow.")
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
using Velopack.Packaging.Flow;
|
||||
|
||||
#nullable enable
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
|
||||
internal class LogoutCommandRunner(IVelopackFlowServiceClient Client) : ICommand<LogoutOptions>
|
||||
{
|
||||
5
src/Velopack.Vpk/Commands/Flow/LogoutOptions.cs
Normal file
5
src/Velopack.Vpk/Commands/Flow/LogoutOptions.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using Velopack.Packaging.Flow;
|
||||
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
|
||||
public sealed class LogoutOptions : VelopackServiceOptions;
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
#nullable enable
|
||||
|
||||
public abstract class VelopackBaseCommand : OutputCommand
|
||||
@@ -7,7 +7,7 @@ public abstract class VelopackBaseCommand : OutputCommand
|
||||
|
||||
public string? ProjectName { get; private set; }
|
||||
|
||||
protected VelopackBaseCommand(string name, string description)
|
||||
protected VelopackBaseCommand(string name, string description)
|
||||
: base(name, description)
|
||||
{
|
||||
AddOption<string>((v) => TeamName = v, "--team-name", "-t")
|
||||
@@ -19,14 +19,3 @@ public abstract class VelopackBaseCommand : OutputCommand
|
||||
.SetRequired();
|
||||
}
|
||||
}
|
||||
|
||||
public class VelopackPublishCommand : VelopackBaseCommand
|
||||
{
|
||||
public string? Version { get; set; }
|
||||
|
||||
public VelopackPublishCommand()
|
||||
: base ("publish", "Uploads a release to Velopack's hosted service")
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
13
src/Velopack.Vpk/Commands/Flow/VelopackPublishCommand.cs
Normal file
13
src/Velopack.Vpk/Commands/Flow/VelopackPublishCommand.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
#nullable enable
|
||||
|
||||
public class VelopackPublishCommand : VelopackBaseCommand
|
||||
{
|
||||
public string? Version { get; set; }
|
||||
|
||||
public VelopackPublishCommand()
|
||||
: base("publish", "Uploads a release to Velopack's hosted service")
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Velopack.Packaging.Flow;
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
namespace Velopack.Vpk.Commands.Flow;
|
||||
|
||||
public abstract class VelopackServiceCommand : BaseCommand
|
||||
{
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Velopack.Vpk.Commands;
|
||||
public class LoginCommand : VelopackServiceCommand
|
||||
{
|
||||
public LoginCommand()
|
||||
: base("login", "Login to Velopack's hosted service.")
|
||||
{
|
||||
//Just hiding this for now as it is not ready for mass consumption.
|
||||
Hidden = true;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
using Velopack.Packaging.Flow;
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
|
||||
public sealed class LoginOptions: VelopackServiceOptions;
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Velopack.Vpk.Commands;
|
||||
public class LogoutCommand : VelopackServiceCommand
|
||||
{
|
||||
public LogoutCommand()
|
||||
: base("logout", "Remove any stored credential to the Velopack service.")
|
||||
{
|
||||
//Just hiding this for now as it is not ready for mass consumption.
|
||||
Hidden = true;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
using Velopack.Packaging.Flow;
|
||||
|
||||
namespace Velopack.Vpk.Commands;
|
||||
|
||||
public sealed class LogoutOptions: VelopackServiceOptions;
|
||||
@@ -4,6 +4,8 @@ using Velopack.Packaging.Commands;
|
||||
using Velopack.Packaging.Unix.Commands;
|
||||
using Velopack.Packaging.Windows.Commands;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Commands.Deployment;
|
||||
using Velopack.Vpk.Commands.Flow;
|
||||
|
||||
namespace Velopack.Vpk;
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ using Velopack.Packaging.Flow;
|
||||
using Velopack.Packaging.Unix.Commands;
|
||||
using Velopack.Packaging.Windows.Commands;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Commands.Deployment;
|
||||
using Velopack.Vpk.Commands.Flow;
|
||||
using Velopack.Vpk.Converters;
|
||||
using Velopack.Vpk.Logging;
|
||||
using Velopack.Vpk.Updates;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.CommandLine;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
namespace Velopack.CommandLine.Tests.Commands;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.CommandLine;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
namespace Velopack.CommandLine.Tests.Commands;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
using System.CommandLine;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
namespace Velopack.CommandLine.Tests.Commands;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.CommandLine;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
namespace Velopack.CommandLine.Tests.Commands;
|
||||
public class LocalDownloadCommandTests : BaseCommandTests<LocalDownloadCommand>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.CommandLine;
|
||||
using Velopack.Vpk.Commands;
|
||||
using Velopack.Vpk.Commands.Deployment;
|
||||
|
||||
namespace Velopack.CommandLine.Tests.Commands;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user