Exemple #1
0
        public override void Execute(string[] args)
        {
            if (args == null || args.Length != 1)
            {
                DisplayUsage();
            }
            else
            {
                var name = args[0];

                if (name == "list")
                {
                    DisplayCommandList();
                }
                else
                {
                    var command = Console.SupportedCommands.FirstOrDefault(c => c.Key == name);

                    if (command == null)
                    {
                        var message = string.Format(SceneTree.Tr("console.error.command.invalid"), name);

                        Console.Warning(message).NewLine();
                    }
                    else
                    {
                        command.DisplayUsage();
                    }
                }
            }
        }
Exemple #2
0
 public override void DisplayUsage()
 {
     Console
     .Text("[").Text(SceneTree.Tr("console.usage")).Text("]").NewLine()
     .NewLine()
     .Text("> ").Highlight(Key).NewLine()
     .Text(SceneTree.Tr("console.command.help.self")).NewLine()
     .Text("> ").Highlight("help list").NewLine()
     .Text(SceneTree.Tr("console.command.help.list")).NewLine()
     .Text("> ").Highlight("help <command>").NewLine()
     .Text(SceneTree.Tr("console.command.help.command")).NewLine();
 }
Exemple #3
0
        public void DisplayCommandList()
        {
            Console
            .Text("[").Text(SceneTree.Tr("console.commands")).Text("]").NewLine()
            .NewLine();

            foreach (var command in Console.SupportedCommands)
            {
                Console
                .Highlight(command.Key).Text(" - ").Text(command.Description).NewLine();
            }
        }
Exemple #4
0
        public override void Execute(params string[] args)
        {
            args.HeadOrNone().Match(name =>
            {
                if (name == "list")
                {
                    DisplayCommandList();
                }
                else
                {
                    var command = Console.SupportedCommands.Find(c => c.Key == name);

                    command.BiIter(
                        c => c.DisplayUsage(),
                        () =>
                    {
                        var message = string.Format(SceneTree.Tr("console.error.command.invalid"), name);

                        Console.Warning(message).NewLine();
                    });
                }
            },
                                    DisplayUsage);
        }