Пример #1
0
        private static void RegisterCommands(Shell shell, bool interactive)
        {
            if (interactive)
            {
                shell.AddCommand("exit", "Exit from program", Exit);
                shell.AddCommand("quit", "Exit from program", Exit);
            }

            shell.AddCommand(new HelpShellCommand());
            shell.AddCommand(new GetUsersCommand(_terminal));
            shell.AddCommand(new CreateUserCommand(_terminal));
        }
Пример #2
0
        public static void AddCommand(string name, Action <CommandArg[]> proc, int min_arg_count = 0, int max_arg_count = -1, string help = "")
        {
            var info = new CommandInfo()
            {
                proc          = proc,
                min_arg_count = min_arg_count,
                max_arg_count = max_arg_count,
                help          = help
            };

            Shell.AddCommand(name, info);
            Autocomplete.Register(name);
        }
Пример #3
0
        private static void RegisterCommands(Shell shell, bool interactive)
        {
            if (interactive)
            {
                shell.AddCommand("exit", "Exit from program", Exit);
                shell.AddCommand("quit", "Exit from program", Exit);
            }

            shell.AddCommand(new HelpShellCommand());
            shell.AddCommand("options", "Test options", InvokeTestOptions);

            shell.AddCommand(new FakeShellCommand("sip list", "list sip peers"));
            shell.AddCommand(new FakeShellCommand("sip add", "add sip peer"));
            shell.AddCommand(new FakeShellCommand("sip delete", "delete sip peer"));
            shell.AddCommand(new FakeShellCommand("sip acl list"));
            shell.AddCommand(new FakeShellCommand("sip acl add"));
            shell.AddCommand(new FakeShellCommand("sip acl delete"));
            shell.AddCommand(new FakeShellCommand("sip acl stick"));
            shell.AddCommand(new FakeShellCommand("sip acl flush"));

            shell.AddCommand(new FakeShellCommand("ip show"));

            shell.AddCommand(new CompleteMultipleFakeShellCommand("list"));
            shell.AddCommand(new CompleteOneFakeShellCommand("show"));

            shell.AddCommand(new AdditionalInputShellCommand());
        }