private void Initialize(CommandHostContext context) { context.Arguments = new OrchardParametersParser().Parse(new CommandParametersParser().Parse(_args)); context.CommandHost = new CommandHostAgent( _serviceProvider.GetService <IOrchardHost>(), _serviceProvider.GetService <IShellSettingsManager>(), _serviceProvider.GetService <IStringLocalizer>() ); // Perform some argument validation and display usage if something is incorrect context.DisplayUsageHelp = context.Arguments.Switches.ContainsKey("?"); if (context.DisplayUsageHelp) { return; } context.DisplayUsageHelp = (context.Arguments.Arguments.Count > 0 && context.Arguments.ResponseFiles.Count > 0); if (context.DisplayUsageHelp) { _logger.LogError("Incorrect syntax: Response files cannot be used in conjunction with commands"); return; } context.StartSessionResult = CommandReturnCodes.Ok; }
private void Initialize(CommandHostContext context) { context.Arguments = new OrchardParametersParser().Parse(new CommandParametersParser().Parse(_args)); // Perform some argument validation and display usage if something is incorrect context.DisplayUsageHelp = context.Arguments.Switches.ContainsKey("?"); if (context.DisplayUsageHelp) { return; } context.DisplayUsageHelp = (context.Arguments.Arguments.Any() && context.Arguments.ResponseFiles.Any()); if (context.DisplayUsageHelp) { _logger.LogError("Incorrect syntax: Response files cannot be used in conjunction with commands"); return; } context.StartSessionResult = CommandReturnCodes.Ok; }