Exemple #1
0
        internal CommandConsole(Frontend frontend, IValueConverter valueConverter, IFileSystem fileSystem,
                                IShell shell, ICommandRegistryInternal commandRegistry, ICommandExecutor commandExecutor,
                                ConsoleConfiguration config)
        {
            Current           = this;
            LConsole.Frontend = frontend;

            var history = new History();

            frontend.History = history;

            this.Config          = config ?? new ConsoleConfiguration();
            this.FileSystem      = fileSystem;
            this.CommandRegistry = commandRegistry;
            this.Shell           = shell ?? new Shell(valueConverter, history, fileSystem, new CommandFinder(commandRegistry),
                                                      new Environment(), commandExecutor, null, config);

            frontend.LineInput += Frontend_LineInput;

            Commands.RegisterCommandsIn(this.GetType().Assembly);
            Commands.RegisterCommandsIn(frontend.GetType().Assembly);

            if (config.RegisterAllCommandsOnStartup)
            {
                Commands.RegisterCommandsInAllAssemblies();
            }

            frontend.Init();
        }
Exemple #2
0
 /// <summary>
 /// Instantiate a new <see cref="CommandConsole"/> instance.
 /// </summary>
 /// <param name="frontend">The frontend to use for this console.</param>
 /// <param name="config">The console configuration.</param>
 public CommandConsole(Frontend frontend, ObjectProviderDelegate objectProvider = null, ConsoleConfiguration config = null)
     : this(frontend, new DefaultValueConverter(), null, objectProvider, config)
 {
 }
Exemple #3
0
 /// <summary>
 /// Instantiate a new <see cref="CommandConsole"/> instance.
 /// </summary>
 /// <param name="frontend">The frontend to use for this console.</param>
 /// <param name="filesRootPath">The root folder for commands like exec.</param>
 /// <param name="config">The console configuration.</param>
 public CommandConsole(Frontend frontend, string filesRootPath, ObjectProviderDelegate objectProvider = null, ConsoleConfiguration config = null)
     : this(frontend, new DefaultValueConverter(), new SystemIOFilesystem(filesRootPath), objectProvider, config)
 {
 }
Exemple #4
0
 /// <summary>
 /// Instantiate a new <see cref="CommandConsole"/> instance.
 /// </summary>
 /// <param name="frontend">The frontend to use for this console.</param>
 /// <param name="valueConverter">The value converter to use for command arguments.</param>
 /// <param name="fileSystem">The file system for commands like exec.</param>
 /// <param name="objectProvider">The object provider for injecting dependencies into methods.</param>
 /// <param name="config">The console configuration.</param>
 public CommandConsole(Frontend frontend, IValueConverter valueConverter, IFileSystem fileSystem, ObjectProviderDelegate objectProvider, ConsoleConfiguration config = null)
     : this(frontend, valueConverter, fileSystem, null, new CommandRegistry(), new CommandExecutor(objectProvider), config ?? new ConsoleConfiguration())
 {
 }