/// <summary> /// Initializes a new instance of the <see cref="ScriptPipeline"/> class. /// </summary> /// <param name="console">The <see cref="IPenshellConsole"/> instance.</param> /// <param name="scriptLines">The script lines.</param> /// <param name="logger">The <see cref="ILogger"/> instance.</param> /// <param name="registry">The <see cref="PenshellCommandRegistry"/> instance.</param> public ScriptPipeline( IPenshellConsole console, IEnumerable <ScriptLine> scriptLines, ILogger?logger, PenshellCommandRegistry registry) { _console = console ?? throw new ArgumentNullException(nameof(console)); _scriptLines = scriptLines; _logger = logger; _registry = registry; }
/// <summary> /// Initializes a new instance of the <see cref="RunCommand"/> class. /// </summary> /// <param name="console">The <see cref="IPenshellConsole"/> instance.</param> /// <param name="registry"> /// A <see cref="PenshellCommandRegistry"/> instance. /// </param> /// <param name="logger"> /// A <see cref="ILogger"/> instance. /// </param> public RunCommand( IPenshellConsole console, PenshellCommandRegistry registry, ILogger logger) : base(console, "run", "Runs a penshell script.") { this.Registry = registry; this.Logger = logger; this.AddOption( new Option( new string[] { "-p", "--path" }, "The path to the script.") { Argument = new Argument <FileInfo>(), Required = true, }); }
/// <summary> /// A fluent method to inject a <see cref="PenshellCommandRegistry"/> instance. /// </summary> /// <param name="registry"> /// The <see cref="PenshellCommandRegistry"/> instance. /// </param> /// <returns> /// The fluent instance. /// </returns> public ScriptPipelineBuilder UseCommandRegistry(PenshellCommandRegistry registry) { _registry = registry; return(this); }