Esempio n. 1
0
        public void AddProcessorEntry(ICommandLineProcessor value)
        {
            if (!value.IsInitialized())
                return;

            _processors[value.GetProcessorKey()] = value;
        }
Esempio n. 2
0
        /// <summary>
        /// setup properties of clp and shell env from the settings object and envrionment variables
        /// </summary>
        /// <param name="clp">clp</param>
        /// <param name="settings">clp settings</param>
        void ShellInitFromSettings(
            ICommandLineProcessor clp,
            ICommandLineProcessorSettings settings
            )
        {
            var ctx = clp.CommandEvaluationContext;

            _console.Out.EnableAvoidEndOfLineFilledWithBackgroundColor = ctx.ShellEnv.GetValue <bool>(ShellEnvironmentVar.settings_console_enableAvoidEndOfLineFilledWithBackgroundColor);
            var prompt = ctx.ShellEnv.GetValue <string>(ShellEnvironmentVar.settings_console_prompt);

            clp.CommandLineReader.SetDefaultPrompt(prompt);

            var pathexts        = ctx.ShellEnv.GetValue <List <string> >(ShellEnvironmentVar.pathExt);
            var pathextinit     = ctx.ShellEnv.GetDataValue(ShellEnvironmentVar.pathExtInit);
            var pathextinittext = (string)pathextinit.Value;

            if (!string.IsNullOrWhiteSpace(pathextinittext))
            {
                pathextinittext += ShellEnvironment.SystemPathSeparator;
            }
            pathextinittext += settings.PathExtInit.Replace(";", ShellEnvironment.SystemPathSeparator);
            pathextinit.SetValue(pathextinittext);
            var exts = pathextinittext.Split(ShellEnvironment.SystemPathSeparator);

            foreach (var ext in exts)
            {
                pathexts.AddUnique(ext);
            }

            ctx.ShellEnv.SetValue(ShellEnvironmentVar.settings_clp_shellExecBatchExt, settings.ShellExecBatchExt);
        }
Esempio n. 3
0
 public ShellBootstrap(
     ICommandLineProcessor clp,
     IShellArgsOptionBuilder shellArgsOptionBuilder)
 {
     _clp     = clp;
     _console = clp.Console;
     _shellArgsOptionBuilder = shellArgsOptionBuilder;
 }
 public CommandLineConsole([NotNull] IFactory factory)
 {
     if (factory == null)
     {
         throw new ArgumentNullException(nameof(factory));
     }
     _processor = factory.GetInstance <ICommandLineProcessor>();
 }
 public ShellServiceHost(
     IConsole console,
     ICommandLineProcessor commandLineProcessor,
     ICommandLineReader commandLineReader,
     IShellBootstrap shellBootstrap
     )
 {
     _cons           = console;
     _clp            = commandLineProcessor;
     _clr            = commandLineReader;
     _shellBootstrap = shellBootstrap;
 }
 public void Initialize(
     string prompt             = null,
     ICommandLineProcessor clp = null,
     Delegates.ExpressionEvaluationCommandDelegate evalCommandDelegate = null)
 {
     _defaultPrompt        = prompt ?? $"> ";
     Console               = clp.Console;
     _commandLineProcessor = clp;
     if (_commandLineProcessor != null && _commandLineProcessor != null)
     {
         _commandLineProcessor.CommandLineReader = this;
     }
     Initialize(evalCommandDelegate);
 }