File: Commands\TrayCommand.cs
Web Access
Project: src\src\Aspire.Cli\Aspire.Cli.csproj (aspire)
// 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.Resources;
 
namespace Aspire.Cli.Commands;
 
/// <summary>
/// Manages the bundled desktop tray companion (Preview).
/// </summary>
internal sealed class TrayCommand : ParentCommand
{
    internal override HelpGroup HelpGroup => HelpGroup.Monitoring;
 
    public TrayCommand(TrayStartCommand startCommand, TrayStopCommand stopCommand, IEnvironment environment, CommonCommandServices services)
        : base("tray", TrayCommandStrings.Description, services)
    {
        // Keep desktop-only commands out of help on unsupported operating systems.
        // TrayLifecycleService still rejects unsupported platforms because hidden commands remain invocable.
        Hidden = (!environment.IsMacOS() && !environment.IsWindows() && !environment.IsLinux())
            || environment.RuntimeIdentifier.StartsWith("linux-musl-", StringComparison.Ordinal);
 
        Subcommands.Add(startCommand);
        Subcommands.Add(stopCommand);
    }
}