using System;
namespace Unity.Pipeline.Commands
{
///
/// Attribute to mark static methods as CLI-accessible commands.
/// Commands with this attribute can be executed remotely via Pipeline Server.
/// Adapted from unity-tools [Tool] attribute for Pipeline organization requirements.
///
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public class CliCommandAttribute : Attribute
{
///
/// Unique name of the command for CLI execution.
/// Used in "unity request command_name" syntax.
///
public string Name { get; }
///
/// Human-readable description of what the command does.
/// Used in CLI help text and command discovery.
///
public string Description { get; }
///
/// Whether this command requires Unity main thread execution.
/// Default: true (most Unity APIs require main thread).
///
public bool MainThreadRequired { get; set; } = true;
///
/// Whether this command belongs to the runtime (Player) command surface only.
/// Runtime-only commands are hidden from an Editor server's command listing
/// (they remain executable, but are not advertised when connected to an Editor).
/// Default: false (listed on the Editor server).
///
public bool RuntimeOnly { get; set; } = false;
///
/// Create a new CLI command attribute.
///
/// Unique command name for CLI execution
/// Human-readable description
public CliCommandAttribute(string name, string description)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Description = description ?? throw new ArgumentNullException(nameof(description));
}
}
}