mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2026-01-02 01:03:32 +01:00
CommandOptions now has an IsHidden property that, when set to true, will cause the option to be hidden from the following cases: - Help text using `-h|--help` - Xml representations generated with the `cli xml` command - Diagnostics displayed with the `cli explain` command Hidden options can still be outputted with `cli explain` using the `--hidden` option that is also used to display hidden commands. Fixes #631
26 lines
958 B
C#
26 lines
958 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Reflection;
|
|
|
|
namespace Spectre.Console.Cli
|
|
{
|
|
internal sealed class CommandArgument : CommandParameter
|
|
{
|
|
public string Value { get; }
|
|
public int Position { get; set; }
|
|
|
|
public CommandArgument(
|
|
Type parameterType, ParameterKind parameterKind, PropertyInfo property, string? description,
|
|
TypeConverterAttribute? converter, DefaultValueAttribute? defaultValue,
|
|
CommandArgumentAttribute argument, ParameterValueProviderAttribute? valueProvider,
|
|
IEnumerable<ParameterValidationAttribute> validators)
|
|
: base(parameterType, parameterKind, property, description, converter, defaultValue,
|
|
null, valueProvider, validators, argument.IsRequired, false)
|
|
{
|
|
Value = argument.ValueName;
|
|
Position = argument.Position;
|
|
}
|
|
}
|
|
}
|