コード例 #1
0
ファイル: Program.cs プロジェクト: votrongdao/DesignPattern
        static void Main(string[] args)
        {
            var availableCommands = GetAvailableCommands();
            if(args.Length == 0)
            {
                PrintUsage(availableCommands);
                return;
            }

            var parser = new CommandParser(availableCommands);
            var command = parser.ParseCommand(args);

            //Removed the null check because introduced the logic of returning the NullCommand object if the command is invalid
            //if (command != null)

            command.Execute();
        }