-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathCommandParser.cs
More file actions
36 lines (32 loc) · 913 Bytes
/
CommandParser.cs
File metadata and controls
36 lines (32 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
namespace TodoList.ConsoleApp.Commands
{
using System;
public sealed class CommandParser
{
private ICommand[] commands;
public CommandParser()
{
commands = new ICommand[]
{
new DevelopmentModeCommand(),
new InteractiveCommand(),
new DoCommand(),
new HelpCommand(),
new ListCommand(),
new RemoveCommand(),
new RenameCommand(),
new TodoCommand(),
new UndoCommand(),
new GistTokenCommand(),
new GistIdCommand()
};
}
public ICommand ParseCommand(string[] args)
{
foreach (var command in commands)
if (command.Match(args))
return command;
return new HelpCommand();
}
}
}