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(); }