using System;
using JetBrains.Annotations;
namespace Robust.Shared.Toolshed;
///
/// Used to mark a class so that automatically discovers and registers it.
///
[AttributeUsage(AttributeTargets.Class)]
[MeansImplicitUse]
public sealed class ToolshedCommandAttribute : Attribute
{
public string? Name = null;
}
///
/// Marks a function in a as being an implementation of that command, so that Toolshed will use it's signature for parsing/etc.
///
[AttributeUsage(AttributeTargets.Method)]
[MeansImplicitUse]
public sealed class CommandImplementationAttribute : Attribute
{
public readonly string? SubCommand = null;
public CommandImplementationAttribute(string? subCommand = null)
{
SubCommand = subCommand;
}
}
///
/// Marks an argument in a function in a as being the "piped" argument, the return value of the prior command in the chain.
///
[AttributeUsage(AttributeTargets.Parameter)]
[MeansImplicitUse]
public sealed class PipedArgumentAttribute : Attribute
{
}
///
/// Marks an argument in a function as being an argument of a .
/// This will make it so the argument will get parsed.
///
[AttributeUsage(AttributeTargets.Parameter)]
[MeansImplicitUse]
public sealed class CommandArgumentAttribute : Attribute
{
}
///
/// Marks an argument in a function as specifying whether or not this call to a is inverted.
///
[AttributeUsage(AttributeTargets.Parameter)]
[MeansImplicitUse]
public sealed class CommandInvertedAttribute : Attribute
{
}
///
/// Marks an argument in a function as being where the invocation context should be provided in a .
///
///
[AttributeUsage(AttributeTargets.Parameter)]
[MeansImplicitUse]
public sealed class CommandInvocationContextAttribute : Attribute
{
}
///
/// Marks a command implementation as taking the type of the previous command in sequence as a generic argument.
///
///
/// If the argument marked with is not T but instead a pattern like IEnumerable<T>, Toolshed will account for this.
///
[AttributeUsage(AttributeTargets.Method)]
public sealed class TakesPipedTypeAsGenericAttribute : Attribute
{
}
// Internal because this is just a hack at the moment and should be replaced with proper inference later!
// Overrides type argument parsing to parse a block and then use it's return type as the sole type argument.
internal sealed class MapLikeCommandAttribute : Attribute
{
public bool TakesPipedType;
public MapLikeCommandAttribute(bool takesPipedType = true)
{
TakesPipedType = takesPipedType;
}
}