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]; } } } }
void SetupConsole() { if (is_unix) { string term = Environment.GetEnvironmentVariable("TERM"); dumb = term == "dumb" || term == null || isatty == false; } else { dumb = false; } editor = new Mono.Terminal.LineEditor("csharp", 300) { HeuristicsMode = "csharp" }; InteractiveBaseShell.Editor = editor; editor.AutoCompleteEvent += delegate(string s, int pos){ string prefix = null; string complete = s.Substring(0, pos); string [] completions = evaluator.GetCompletions(complete, out prefix); return(new Mono.Terminal.LineEditor.Completion(prefix, completions)); }; #if false // // This is a sample of how completions sould be implemented. // editor.AutoCompleteEvent += delegate(string s, int pos){ // Single match: "Substring": Sub-string if (s.EndsWith("Sub")) { return(new string [] { "string" }); } // Multiple matches: "ToString" and "ToLower" if (s.EndsWith("T")) { return(new string [] { "ToString", "ToLower" }); } return(null); }; #endif Console.CancelKeyPress += ConsoleInterrupt; }
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); } } }
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); } } }
void SetupConsole () { if (is_unix){ string term = Environment.GetEnvironmentVariable ("TERM"); dumb = term == "dumb" || term == null || isatty == false; } else dumb = false; editor = new Mono.Terminal.LineEditor ("csharp", 300); InteractiveBaseShell.Editor = editor; editor.AutoCompleteEvent += delegate (string s, int pos){ string prefix = null; string complete = s.Substring (0, pos); string [] completions = evaluator.GetCompletions (complete, out prefix); return new Mono.Terminal.LineEditor.Completion (prefix, completions); }; #if false // // This is a sample of how completions sould be implemented. // editor.AutoCompleteEvent += delegate (string s, int pos){ // Single match: "Substring": Sub-string if (s.EndsWith ("Sub")){ return new string [] { "string" }; } // Multiple matches: "ToString" and "ToLower" if (s.EndsWith ("T")){ return new string [] { "ToString", "ToLower" }; } return null; }; #endif Console.CancelKeyPress += ConsoleInterrupt; }
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 (); }
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]; } } }