Example #1
0
 public void CloseApplication(
     IOutput output)
 {
     HFM.Session sess = (HFM.Session)_context.Remove(typeof(HFM.Session));
     if (sess != null)
     {
         _log.InfoFormat("Closed session to {0}", sess.Application);
     }
     else
     {
         _log.Warn("No application is open");
     }
 }
Example #2
0
        /// Launches in REPL mode
        protected void StartREPL()
        {
            // TODO: Process any options passed on command-line
            string        input  = null;
            ValueArgument cmdArg = new PositionalArgument()
            {
                Key         = "Command",
                Description = "The name of the command to execute, or Quit to exit",
                IsRequired  = true,
                Validate    = ValidateCommand
            };

            System.Console.Title = string.Format("{0} Shell", ApplicationInfo.Title);
            _cmdLine.DisplayTitle(System.Console.Out);
            _cmdLine.WriteLine("Enter 'help' for help, or 'quit' to exit");
            _cmdLine.WriteLine();

            _inREPL = true;
            while (true)
            {
                HFM.Session sess = (HFM.Session)_context[typeof(HFM.Session)];
                input = _cmdLine.ReadLine(string.Format("{0}hfm> ", sess == null ? "" :
                                                        "[" + sess.Cluster + ':' + sess.Application + "] "));

                if (UI.Interrupted ||
                    String.Compare(input, "exit", StringComparison.OrdinalIgnoreCase) == 0 ||
                    String.Compare(input, "quit", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    break;
                }

                if (input.Trim().Length > 0)
                {
                    _cmdLine.ClearArguments();
                    SetupCommandLine();
                    ProcessCommandLine(("hfm " + input).SplitSpaces());
                }
            }
            _inREPL = false;
        }