Esempio n. 1
0
        private static void CreateUserConsole()
        {
            string input;
            string promptName = "First name: ";

            // Last name:
            // E-mail:
            // Password:

            Mono.Terminal.LineEditor console = new Mono.Terminal.LineEditor("Simian");

            // FIXME: Finish implementing this to force a grid admin to be created on startup.
            // This will resolve the bootstrapping issues with estate/parcel ownership
            while (m_running && (input = console.Edit(promptName, String.Empty)) != null)
            {
                string[] inputWords = input.Split(' ');
                if (inputWords.Length > 0)
                {
                    string   command = inputWords[0];
                    string[] args    = new string[inputWords.Length - 1];

                    for (int i = 0; i < args.Length; i++)
                    {
                        args[i] = inputWords[i + 1];
                    }
                }
            }
        }
Esempio n. 2
0
        string GetLine(bool primary)
        {
            string prompt = primary ? InteractiveBase.Prompt : InteractiveBase.ContinuationPrompt;

            if (dumb)
            {
                if (isatty)
                {
                    Console.Write(prompt);
                }

                return(Console.ReadLine());
            }
            else
            {
                return(editor.Edit(prompt, ""));
            }
        }
Esempio n. 3
0
        private static void InteractiveConsole()
        {
            // Initialize the interactive console
            Mono.Terminal.LineEditor console = new Mono.Terminal.LineEditor("Simian", 100);
            console.TabAtStartCompletes = true;

            console.AutoCompleteEvent +=
                delegate(string text, int pos)
            {
                string prefix   = null;
                string complete = text.Substring(0, pos);

                string[] completions = m_simian.GetCompletions(complete, out prefix);
                return(new Mono.Terminal.LineEditor.Completion(prefix, completions));
            };

            // Wait a moment for async startup log messages to print so they don't hide
            // the initial console
            Thread.Sleep(Simian.LONG_SLEEP_INTERVAL);

            // Do a one-time forced garbage collection once everything is loaded and running
            GC.Collect();

            string input;
            string promptName = "simian";

            while (m_running && (input = console.Edit(promptName + '>', String.Empty)) != null)
            {
                string[] inputWords = input.Split(' ');
                if (inputWords.Length > 0)
                {
                    string   command = inputWords[0];
                    string[] args    = new string[inputWords.Length - 1];

                    for (int i = 0; i < args.Length; i++)
                    {
                        args[i] = inputWords[i + 1];
                    }

                    m_simian.HandleCommand(command, args, out promptName);
                }
            }
        }
Esempio n. 4
0
        private static void InteractiveConsole()
        {
            // Initialize the interactive console
            Mono.Terminal.LineEditor console = new Mono.Terminal.LineEditor("Simian", 100);
            console.TabAtStartCompletes = true;

            console.AutoCompleteEvent +=
                delegate(string text, int pos)
                {
                    string prefix = null;
                    string complete = text.Substring(0, pos);

                    string[] completions = m_simian.GetCompletions(complete, out prefix);
                    return new Mono.Terminal.LineEditor.Completion(prefix, completions);
                };

            // Wait a moment for async startup log messages to print so they don't hide
            // the initial console
            Thread.Sleep(Simian.LONG_SLEEP_INTERVAL);

            // Do a one-time forced garbage collection once everything is loaded and running
            GC.Collect();

            string input;
            string promptName = "simian";

            while (m_running && (input = console.Edit(promptName + '>', String.Empty)) != null)
            {
                string[] inputWords = input.Split(' ');
                if (inputWords.Length > 0)
                {
                    string command = inputWords[0];
                    string[] args = new string[inputWords.Length - 1];

                    for (int i = 0; i < args.Length; i++)
                        args[i] = inputWords[i + 1];

                    m_simian.HandleCommand(command, args, out promptName);
                }
            }
        }
Esempio n. 5
0
        public static void RunPrompt()
        {
            Mono.Terminal.LineEditor lineEditor = new Mono.Terminal.LineEditor ("FxGqlC", 50);
            lineEditor.CtrlOPressed += delegate(object sender, EventArgs args) {
                try {
                    //var copy = Console.Error;
                    //Console.SetError (TextWriter.Null);
                    string currentDirectory = gqlEngine.GqlEngineState.CurrentDirectory;
                    string[] files = FxGqlCWin.FileSelector.SelectMultipleFileRead ("Select filename(s) to inject in query string", currentDirectory);
                    //Console.SetError (copy);
                    if (files != null) {
                        StringBuilder sb = new StringBuilder ();
                        foreach (string file in files) {
                            string relativeFile = MakeRelative (currentDirectory, file);
                            if (sb.Length > 0)
                                sb.Append (", ");
                            sb.AppendFormat ("['{0}']", relativeFile);
                        }
                        lineEditor.Type (sb.ToString ());
                    }
                } catch (Exception) {
                    // Ignore exceptions to prevent crash when DLL cannot be found.
                }
            };

            while (continuePromptMode) {
                string command = lineEditor.Edit ("FxGqlC> ", "");
                //Console.Write ("FxGqlC> ");
                //string command = Console.ReadLine ();
                if (command.Trim ().Equals ("exit", StringComparison.InvariantCultureIgnoreCase)
                    || command.Trim ().Equals ("quit", StringComparison.InvariantCultureIgnoreCase))
                    command = "!!exit";
                if (!ExecutePromptCommand (command, lineEditor))
                if (!ExecuteAliasCommand (command))
                    ExecuteCommand (command);
            }
            lineEditor.Close ();
        }
Esempio n. 6
0
        private static void CreateUserConsole()
        {
            string input;
            string promptName = "First name: ";
            // Last name:
            // E-mail:
            // Password:

            Mono.Terminal.LineEditor console = new Mono.Terminal.LineEditor("Simian");

            // FIXME: Finish implementing this to force a grid admin to be created on startup.
            // This will resolve the bootstrapping issues with estate/parcel ownership
            while (m_running && (input = console.Edit(promptName, String.Empty)) != null)
            {
                string[] inputWords = input.Split(' ');
                if (inputWords.Length > 0)
                {
                    string command = inputWords[0];
                    string[] args = new string[inputWords.Length - 1];

                    for (int i = 0; i < args.Length; i++)
                        args[i] = inputWords[i + 1];
                }
            }
        }