|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Aspire.Cli.Configuration;
using Aspire.Cli.DotNet;
using Aspire.Cli.Interaction;
using Aspire.Cli.Projects;
using Aspire.Cli.Resources;
using Aspire.Cli.Telemetry;
using Aspire.Cli.Utils;
namespace Aspire.Cli.Commands;
internal sealed class DeployCommand : PublishCommandBase
{
public DeployCommand(IDotNetCliRunner runner, IInteractionService interactionService, IProjectLocator projectLocator, AspireCliTelemetry telemetry, IDotNetSdkInstaller sdkInstaller, IFeatures features, ICliUpdateNotifier updateNotifier, CliExecutionContext executionContext)
: base("deploy", DeployCommandStrings.Description, runner, interactionService, projectLocator, telemetry, sdkInstaller, features, updateNotifier, executionContext)
{
}
protected override string OperationCompletedPrefix => DeployCommandStrings.OperationCompletedPrefix;
protected override string OperationFailedPrefix => DeployCommandStrings.OperationFailedPrefix;
protected override string GetOutputPathDescription() => DeployCommandStrings.OutputPathArgumentDescription;
protected override string[] GetRunArguments(string? fullyQualifiedOutputPath, string[] unmatchedTokens)
{
var baseArgs = new List<string> { "--operation", "publish", "--publisher", "default" };
if (fullyQualifiedOutputPath != null)
{
baseArgs.AddRange(["--output-path", fullyQualifiedOutputPath]);
}
baseArgs.AddRange(["--deploy", "true"]);
baseArgs.AddRange(unmatchedTokens);
return [.. baseArgs];
}
protected override string GetCanceledMessage() => DeployCommandStrings.DeploymentCanceled;
protected override string GetProgressMessage() => PublishCommandStrings.GeneratingArtifacts;
}
|