Use file scoped namespace declarations

This commit is contained in:
Patrik Svensson
2021-12-21 11:06:46 +01:00
committed by Phil Scott
parent 1dbaf50935
commit ec1188b837
607 changed files with 28739 additions and 29245 deletions

View File

@ -1,37 +1,36 @@
using System.Collections.Generic;
namespace Spectre.Console.Cli
namespace Spectre.Console.Cli;
internal sealed class CommandTree
{
internal sealed class CommandTree
public CommandInfo Command { get; }
public List<MappedCommandParameter> Mapped { get; }
public List<CommandParameter> Unmapped { get; }
public CommandTree? Parent { get; }
public CommandTree? Next { get; set; }
public bool ShowHelp { get; set; }
public CommandTree(CommandTree? parent, CommandInfo command)
{
public CommandInfo Command { get; }
public List<MappedCommandParameter> Mapped { get; }
public List<CommandParameter> Unmapped { get; }
public CommandTree? Parent { get; }
public CommandTree? Next { get; set; }
public bool ShowHelp { get; set; }
Parent = parent;
Command = command;
Mapped = new List<MappedCommandParameter>();
Unmapped = new List<CommandParameter>();
}
public CommandTree(CommandTree? parent, CommandInfo command)
public ICommand CreateCommand(ITypeResolver resolver)
{
if (Command.Delegate != null)
{
Parent = parent;
Command = command;
Mapped = new List<MappedCommandParameter>();
Unmapped = new List<CommandParameter>();
return new DelegateCommand(Command.Delegate);
}
public ICommand CreateCommand(ITypeResolver resolver)
if (resolver.Resolve(Command.CommandType) is ICommand command)
{
if (Command.Delegate != null)
{
return new DelegateCommand(Command.Delegate);
}
if (resolver.Resolve(Command.CommandType) is ICommand command)
{
return command;
}
throw CommandParseException.CouldNotCreateCommand(Command.CommandType);
return command;
}
throw CommandParseException.CouldNotCreateCommand(Command.CommandType);
}
}