main
 1using System.Collections.Generic;
 2using System.Linq;
 3
 4namespace gorilla.migrations
 5{
 6    public class ConsoleArgumentsCommandRegistry : CommandRegistry
 7    {
 8        readonly IList<ConsoleCommand> all_commands = new List<ConsoleCommand>();
 9
10        public ParameterizedCommand<ConsoleArguments> command_for(ConsoleArguments arguments)
11        {
12            if (all_commands.Any(x => x.can_handle(arguments)))
13                return all_commands.Single(x => x.can_handle(arguments));
14            return new HelpCommand();
15        }
16
17        public void register(ConsoleCommand command)
18        {
19            all_commands.Add(command);
20        }
21    }
22}