public static void Configure(CommandLineApplication app, CommandLineOptions options, IConsole console) { // description app.Description = "Creates a new user"; app.ExtendedHelpText = $"{Environment.NewLine}Use 'users add -i' to enter interactive mode{Environment.NewLine}"; // arguments var argumentUserId = app.Argument("id", "The user subject identifier", false); var argumentClientTier = app.Argument("tier", string.Concat("The user client tier (", string.Join(" | ", Enum.GetNames(typeof(ClientTierDto))), ")"), false); // options var optionDefaultAssetAccountId = app.Option("-a|--default_account <default_account>", "The default asset account id for the user", CommandOptionType.SingleValue); var optionInteractive = app.Option("-i|--interactive", "Enters interactive mode", CommandOptionType.NoValue); // action (for this command) app.OnExecute( () => { ClientTierDto tier = default; if ((string.IsNullOrEmpty(argumentUserId.Value) || !Enum.TryParse(argumentClientTier.Value, true, out tier)) && !optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } var reporter = new ConsoleReporter(console, options.Verbose.HasValue(), false); var helper = new UserHelper(); var user = new User { UserId = argumentUserId.Value, ClientTier = tier, DefaultAssetAccountId = optionDefaultAssetAccountId.Value(), }; reporter.Verbose("Prototype user (from command line arguments):"); reporter.Verbose(JsonConvert.SerializeObject(user)); if (!helper.IsValid(user) || optionInteractive.HasValue()) { try { user = helper.GetValid(user); } catch (NotSupportedException ex) { throw new CommandParsingException(app, $"Operation Aborted. {ex.Message}", ex); } reporter.Verbose("Validated user (from interactive console):"); reporter.Verbose(JsonConvert.SerializeObject(user)); } options.Command = new AddUserCommand { user = user }; }); }
public static void Configure(CommandLineApplication app, CommandLineOptions options, IConsole console) { // description app.Description = "Terminates a closed asset account"; app.ExtendedHelpText = $"{Environment.NewLine}Use 'accounts terminate -i' to enter interactive mode{Environment.NewLine}"; // arguments var argumentAssetAccountId = app.Argument("account", "The asset account id to terminate", false); // options var optionInteractive = app.Option("-i|--interactive", "Enters interactive mode", CommandOptionType.NoValue); // action (for this command) app.OnExecute( () => { if (string.IsNullOrEmpty(argumentAssetAccountId.Value) && !optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } var reporter = new ConsoleReporter(console, options.Verbose.HasValue(), false); var assetAccountId = argumentAssetAccountId.Value; reporter.Verbose("Prototype account Id (from command line arguments):"); reporter.Verbose($"assetAccountId: {assetAccountId}"); if (string.IsNullOrWhiteSpace(assetAccountId) || optionInteractive.HasValue()) { try { assetAccountId = Safe(Prompt.GetString("Asset Account Id:", assetAccountId), "Cannot terminate account without account id"); } catch (NotSupportedException ex) { throw new CommandParsingException(app, $"Operation Aborted. {ex.Message}", ex); } reporter.Verbose("Validated account Id (from interactive console):"); reporter.Verbose($"assetAccountId: {assetAccountId}"); } options.Command = new TerminateAssetAccountCommand { assetAccountId = assetAccountId }; }); }
public void WritesToStandardStreams() { var testConsole = new TestConsole(); var reporter = new ConsoleReporter(testConsole, verbose: true, quiet: false); // stdout reporter.Verbose("verbose"); Assert.Equal("verbose" + EOL, testConsole.GetOutput()); testConsole.Clear(); reporter.Output("out"); Assert.Equal("out" + EOL, testConsole.GetOutput()); testConsole.Clear(); reporter.Warn("warn"); Assert.Equal("warn" + EOL, testConsole.GetOutput()); testConsole.Clear(); // stderr reporter.Error("error"); Assert.Equal("error" + EOL, testConsole.GetError()); testConsole.Clear(); }
public static void Configure(CommandLineApplication app, CommandLineOptions options, IConsole console) { // description app.Description = $"Creates a new API"; app.ExtendedHelpText = $"{Environment.NewLine}Use 'apis add -i' to enter interactive mode{Environment.NewLine}To add user claims to scopes please use interactive mode{Environment.NewLine}"; // arguments var argumentName = app.Argument("name", "The API name", false); var argumentApiSecret = app.Argument("secret", "The API secret", false); // options #pragma warning disable SA1025 var optionDisplayName = app.Option("-d|--description <description>", "The API description", CommandOptionType.SingleValue); var optionUserClaims = app.Option("-c|--claim <claim>", "A user claim required by the API (you can call this several times)", CommandOptionType.MultipleValue); var optionApiScopes = app.Option("-a|--scope <scope>", "A scope associated with this API (you can call this several times)", CommandOptionType.MultipleValue); var optionDisabled = app.Option("-x|--disabled", "Creates the new API in a disabled state", CommandOptionType.NoValue); var optionInteractive = app.Option("-i|--interactive", "Enters interactive mode", CommandOptionType.NoValue); #pragma warning restore SA1025 app.HelpOption(); // action (for this command) app.OnExecute( () => { if ((string.IsNullOrEmpty(argumentName.Value) || string.IsNullOrEmpty(argumentApiSecret.Value)) && !optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } var reporter = new ConsoleReporter(console, options.Verbose.HasValue(), false); var helper = new ApiResourceHelper(); var resource = new ApiResource { Name = argumentName.Value, ApiSecret = argumentApiSecret.Value, DisplayName = optionDisplayName.Value(), UserClaims = optionUserClaims.HasValue() ? optionUserClaims.Values.Distinct().ToHashSet() : null, ApiScopes = optionApiScopes.HasValue() ? optionApiScopes.Values.Select(name => new ApiResource.Scope { Name = name }).ToHashSet() : null, Enabled = optionDisabled.HasValue() ? (bool?)false : null, }; reporter.Verbose("Prototype API (from command line arguments):"); reporter.Verbose(JsonConvert.SerializeObject(resource)); if (!helper.IsValid(resource) || optionInteractive.HasValue()) { try { resource = helper.GetValid(resource); } catch (NotSupportedException ex) { throw new CommandParsingException(app, $"Operation Aborted. {ex.Message}", ex); } reporter.Verbose("Validated API (from interactive console):"); reporter.Verbose(JsonConvert.SerializeObject(resource)); } options.Command = new AddApiResourceCommand { resource = resource }; }); }
public static void Configure(CommandLineApplication app, CommandLineOptions options, IConsole console) { // description app.Description = "Creates a new user"; app.ExtendedHelpText = $"{Environment.NewLine}Use 'users add -i' to enter interactive mode{Environment.NewLine}"; // arguments var argumentUsername = app.Argument("username", "The username", false); // options #pragma warning disable SA1025 var optionPassword = app.Option("-p|--password <password>", "The password", CommandOptionType.SingleValue); var optionEmail = app.Option("-e|--email <email>", "The email address for the user", CommandOptionType.SingleValue); var optionPhoneNumber = app.Option("-n|--phone <phone>", "The phone number for the user", CommandOptionType.SingleValue); var optionRoles = app.Option("-r|--role <role>", "A role to assign the new user to (you can call this several times)", CommandOptionType.MultipleValue); var optionExternalLoginProvider = app.Option("-l|--login_provider <login_provider>", "The external login provider", CommandOptionType.SingleValue); var optionInteractive = app.Option("-i|--interactive", "Enters interactive mode", CommandOptionType.NoValue); #pragma warning restore SA1025 // action (for this command) app.OnExecute( () => { if (string.IsNullOrEmpty(argumentUsername.Value) && !optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } var reporter = new ConsoleReporter(console, options.Verbose.HasValue(), false); var helper = new UserHelper(); var user = new User { Username = argumentUsername.Value, Password = optionPassword.Value(), Email = optionEmail.Value(), PhoneNumber = optionPhoneNumber.Value(), Roles = optionRoles.HasValue() ? optionRoles.Values.Distinct().ToHashSet() : null, ExternalLoginProvider = optionExternalLoginProvider.Value() }; reporter.Verbose("Prototype user (from command line arguments):"); reporter.Verbose(JsonConvert.SerializeObject(user)); if (!helper.IsValid(user) || optionInteractive.HasValue()) { try { user = helper.GetValid(user); } catch (NotSupportedException ex) { throw new CommandParsingException(app, $"Operation Aborted. {ex.Message}", ex); } reporter.Verbose("Validated user (from interactive console):"); reporter.Verbose(JsonConvert.SerializeObject(user)); } options.Command = new AddUserCommand { user = user }; }); }
public static void Configure(CommandLineApplication app, CommandLineOptions options, IConsole console) { // description app.Description = "Deposits to an asset account"; app.ExtendedHelpText = $"{Environment.NewLine}Use 'accounts deposit -i' to enter interactive mode{Environment.NewLine}"; // arguments var argumentAssetAccountId = app.Argument("account", "The asset account id to deposit", false); var argumentReferenceId = app.Argument("reference", "The unique reference identifier for this transaction", false); var argumentAmount = app.Argument("amount", "The amount to deposit", false); var argumentSettlementCurrency = app.Argument("currency", "The ISO currency code for settlement currency", false); // options var optionInteractive = app.Option("-i|--interactive", "Enters interactive mode", CommandOptionType.NoValue); var optionReferenceText = app.Option("-t|--info", "The reference text which describes about this transaction", CommandOptionType.SingleValue); // action (for this command) app.OnExecute( () => { if ((string.IsNullOrWhiteSpace(argumentAssetAccountId.Value) || string.IsNullOrWhiteSpace(argumentReferenceId.Value) || string.IsNullOrWhiteSpace(argumentSettlementCurrency.Value) || string.IsNullOrWhiteSpace(argumentAmount.Value)) && !optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } if (!decimal.TryParse(argumentAmount.Value, out decimal amount) && !optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } var reporter = new ConsoleReporter(console, options.Verbose.HasValue(), false); var helper = new DepositHelper(); var deposit = new DepositAssetAccount { AssetAccountId = argumentAssetAccountId.Value, ReferenceId = argumentReferenceId.Value, ReferenceText = optionReferenceText.Value(), Amount = amount, SettlementCurrency = argumentSettlementCurrency.Value, Precision = string.IsNullOrEmpty(argumentAmount.Value) ? 0 : helper.GetPrecision(argumentAmount.Value) }; reporter.Verbose("Prototype deposit (from command line arguments):"); reporter.Verbose(JsonConvert.SerializeObject(deposit)); if (!helper.IsValid(deposit) || optionInteractive.HasValue()) { try { deposit = helper.GetValid(deposit); } catch (NotSupportedException ex) { throw new CommandParsingException(app, $"Operation Aborted. {ex.Message}", ex); } reporter.Verbose("Validated deposit (from interactive console):"); reporter.Verbose(JsonConvert.SerializeObject(deposit)); } options.Command = new DepositAssetAccountCommand { deposit = deposit }; }); }
public static void Configure(CommandLineApplication app, CommandLineOptions options, IConsole console) { // description app.Description = "Creates a new client"; app.ExtendedHelpText = $"{Environment.NewLine}Use 'clients add -i' to enter interactive mode{Environment.NewLine}"; // arguments var argumentType = app.Argument("type", "The type of client to add (allowed values are s[erver], w[ebsite], and c[onsole])", false); var argumentClientId = app.Argument("id", "The client identifier", false); // options #pragma warning disable SA1025 var optionName = app.Option("-n|--name <name>", "The name of the client", CommandOptionType.SingleValue); var optionSecret = app.Option("-s|--secret <secret>", "The client secret", CommandOptionType.SingleValue); var optionAllowedCorsOrigins = app.Option("-c|--cors_uri <uri>", "An allowed CORS origin for the client (you can call this several times)", CommandOptionType.MultipleValue); var optionRedirectUris = app.Option("-r|--redirect_uri <uri>", "A redirect URI for the client (you can call this several times)", CommandOptionType.MultipleValue); var optionPostLogoutRedirectUris = app.Option("-l|--logout_uri <uri>", "A logout URI for the client (you can call this several times)", CommandOptionType.MultipleValue); var optionAllowedScopes = app.Option("-a|--scope <scope>", "An allowed scope for the client (you can call this several times)", CommandOptionType.MultipleValue); var optionAccessTokenType = app.Option("-t|--token_type <Jwt/Reference>", "The access token type for the client", CommandOptionType.SingleValue); var optionAllowedGrantTypes = app.Option("-g|--grant_type <type>", "A grant type for the client (you can call this several times)", CommandOptionType.MultipleValue); var optionAllowAccessTokensViaBrowser = app.Option("-b|--browser", "Allow access tokens via browser", CommandOptionType.NoValue); var optionAllowOfflineAccess = app.Option("-o|--offline", "Allow offline access", CommandOptionType.NoValue); var optionDoNotRequireClientSecret = app.Option("-k|--no_secret", "Do not require client secret", CommandOptionType.NoValue); var optionRequirePkce = app.Option("-p|--pkce", "Require Proof Key for Code Exchange (PKCE)", CommandOptionType.NoValue); var optionDoNotRequireConsent = app.Option("-q|--no_constent", "Do not require consent", CommandOptionType.NoValue); var optionDisabled = app.Option("-d|--disabled", "Creates the new client in a disabled state", CommandOptionType.NoValue); var optionInteractive = app.Option("-i|--interactive", "Enters interactive mode", CommandOptionType.NoValue); #pragma warning restore SA1025 app.HelpOption(); // action (for this command) app.OnExecute( () => { var reporter = new ConsoleReporter(console, options.Verbose.HasValue(), false); if (string.IsNullOrEmpty(argumentType.Value)) { // TODO (Cameron): Prompt for client type. reporter.Warn("The type of client is required. Allowed values are s[erver], w[ebsite], and c[onsole]."); return; } var helper = default(IHelper <IroncladClient>); switch (argumentType.Value?.ToUpperInvariant()) { case "S": case "SERVER": helper = new ServerClientHelper(); break; case "W": case "WEBSITE": helper = new WebsiteClientHelper(); break; case "C": case "CONSOLE": helper = new ConsoleClientHelper(); break; case null: default: if (!optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } break; } #pragma warning disable CA1308 reporter.Verbose( $"Command type configured for '{helper.GetType().Name.ToLowerInvariant().Replace("ClientHelper", string.Empty, StringComparison.OrdinalIgnoreCase)}'."); #pragma warning restore CA1308 var client = helper.GetPrototype( new IroncladClient { Id = argumentClientId.Value, Secret = optionSecret.Value(), Name = optionName.Value(), AccessTokenType = optionAccessTokenType.Value(), AllowedCorsOrigins = optionAllowedCorsOrigins.HasValue() ? optionAllowedCorsOrigins.Values.Distinct().ToHashSet() : null, RedirectUris = optionRedirectUris.HasValue() ? optionRedirectUris.Values.Distinct().ToHashSet() : null, PostLogoutRedirectUris = optionPostLogoutRedirectUris.HasValue() ? optionPostLogoutRedirectUris.Values.Distinct().ToHashSet() : null, AllowedScopes = optionAllowedScopes.HasValue() ? optionAllowedScopes.Values.Distinct().ToHashSet() : null, AllowedGrantTypes = optionAllowedGrantTypes.HasValue() ? optionAllowedGrantTypes.Values.Distinct().ToHashSet() : null, AllowAccessTokensViaBrowser = optionAllowAccessTokensViaBrowser.HasValue() ? (bool?)true : null, AllowOfflineAccess = optionAllowOfflineAccess.HasValue() ? (bool?)true : null, RequirePkce = optionRequirePkce.HasValue() ? (bool?)true : null, RequireClientSecret = optionDoNotRequireClientSecret.HasValue() ? (bool?)false : null, RequireConsent = optionDoNotRequireConsent.HasValue() ? (bool?)false : null, Enabled = optionDisabled.HasValue() ? (bool?)false : null, }); reporter.Verbose("Prototype client (from command line arguments):"); reporter.Verbose(JsonConvert.SerializeObject(client)); if (!helper.IsValid(client) || optionInteractive.HasValue()) { try { client = helper.GetValid(client); } catch (NotSupportedException ex) { throw new CommandParsingException(app, $"Operation Aborted. {ex.Message}", ex); } reporter.Verbose("Validated client (from interactive console):"); reporter.Verbose(JsonConvert.SerializeObject(client)); } options.Command = new AddClientCommand { client = client }; }); }
public static void Configure(CommandLineApplication app, CommandLineOptions options, IConsole console) { // description app.Description = "Modifies existing asset account"; app.ExtendedHelpText = $"{Environment.NewLine}Use 'accounts modify -i' to enter interactive mode{Environment.NewLine}"; // arguments var argumentAssetAccountId = app.Argument("account", "The asset account id", false); // options var optionType = app.Option("-t|--type", string.Concat("The asset account type (", string.Join(" | ", Enum.GetNames(typeof(AssetAccountType))), ")"), CommandOptionType.SingleValue); var optionStatus = app.Option("-s|--status", $"The asset account status ({string.Join(" | ", Enum.GetNames(typeof(AssetAccountStatus)))})", CommandOptionType.SingleValue); var optionMarginAccount = app.Option("-m|--margin_account <margin_account>", "The margin account id", CommandOptionType.SingleValue); var optionReferenceAccount = app.Option("-r|--reference_account <reference_account>", "The reference account id", CommandOptionType.SingleValue); var optionBankIdentificationMargin = app.Option("-b|--bank_ident_margin <bank_identification_margin>", "The bank identification margin", CommandOptionType.SingleValue); var optionBankIdentificationReference = app.Option("-i|--bank_ident_reference <bank_identification_reference>", "The bank identification reference", CommandOptionType.SingleValue); var optionWithdrawalAllowed = app.Option("-a|--withdrawal_allowed", "withdrawal allowed", CommandOptionType.NoValue); var optionInteractive = app.Option("-i|--interactive", "Enters interactive mode", CommandOptionType.NoValue); // action (for this command) app.OnExecute( () => { AssetAccountType type = default; AssetAccountStatus status = default; if ((string.IsNullOrWhiteSpace(argumentAssetAccountId.Value) && (string.IsNullOrWhiteSpace(optionType.Value()) || !Enum.TryParse(optionType.Value(), out type)) && (string.IsNullOrWhiteSpace(optionStatus.Value()) || !Enum.TryParse(optionStatus.Value(), out status))) && string.IsNullOrWhiteSpace(optionMarginAccount.Value()) && string.IsNullOrWhiteSpace(optionReferenceAccount.Value()) && string.IsNullOrWhiteSpace(optionBankIdentificationMargin.Value()) && string.IsNullOrWhiteSpace(optionBankIdentificationReference.Value()) && string.IsNullOrWhiteSpace(optionMarginAccount.Value()) && !optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } var withdrawalAllowed = optionWithdrawalAllowed.HasValue(); var reporter = new ConsoleReporter(console, options.Verbose.HasValue(), false); var helper = new AccountHelper(); var account = new InvestorAssetAccountBasicInfo { AssetAccountId = argumentAssetAccountId.Value, MarginAccount = optionMarginAccount.Value(), ReferenceAccount = optionReferenceAccount.Value(), BankIdentificationMargin = optionBankIdentificationMargin.Value(), BankIdentificationReference = optionBankIdentificationReference.Value(), WithdrawalAllowed = withdrawalAllowed, }; if (Enum.TryParse(optionType.Value(), out type)) { account.Type = type; } if (Enum.TryParse(optionStatus.Value(), out status)) { account.Status = status; } reporter.Verbose("Prototype account (from command line arguments):"); reporter.Verbose(JsonConvert.SerializeObject(account)); if (!(helper.IsValid(account) || optionWithdrawalAllowed.HasValue()) || optionInteractive.HasValue()) { try { account = helper.GetValid(account); if (!helper.IsValid(account) && !account.WithdrawalAllowed.HasValue) { throw new CommandParsingException(app, "Operation Aborted. please provide atleast one argument to modify."); } } catch (NotSupportedException ex) { throw new CommandParsingException(app, $"Operation Aborted. {ex.Message}", ex); } reporter.Verbose("Validated account (from interactive console):"); reporter.Verbose(JsonConvert.SerializeObject(account)); } options.Command = new ModifyInvestorAssetAccountCommand { accountBasicInfo = account }; }); }
public static void Configure(CommandLineApplication app, CommandLineOptions options, IConsole console) { // description app.Description = "Creates a new asset account"; app.ExtendedHelpText = $"{Environment.NewLine}Use 'accounts add -i' to enter interactive mode{Environment.NewLine}"; // arguments var argumentAssetAccountId = app.Argument("account", "The asset account id", false); var argumentOwnerId = app.Argument("id", "The user subject identifier of the owner user", false); var argumentIntermediaryId = app.Argument("intermediary", "The intermediary asset account id", false); var argumentType = app.Argument("type", string.Concat("The asset account type (", string.Join(" | ", Enum.GetNames(typeof(AssetAccountType))), ")"), false); // options var optionSettlementCurrency = app.Option("-c|--currency <currency_code>", "The ISO currency code for settlement currency", CommandOptionType.SingleValue); var optionMarginAccount = app.Option("--margin_account <margin_account>", "The margin account id", CommandOptionType.SingleValue); var optionReferenceAccount = app.Option("--reference_account <reference_account>", "The reference account id", CommandOptionType.SingleValue); var optionBankIdentificationMargin = app.Option("--bank_ident_margin <bank_identification_margin>", "The bank identification margin", CommandOptionType.SingleValue); var optionBankIdentificationReference = app.Option("--bank_ident_reference <bank_identification_reference>", "The bank identification reference", CommandOptionType.SingleValue); var optionWithdrawalAllowed = app.Option("--withdrawal_allowed", "withdrawal allowed", CommandOptionType.NoValue); var optionInteractive = app.Option("-i|--interactive", "Enters interactive mode", CommandOptionType.NoValue); // action (for this command) app.OnExecute( () => { AssetAccountType type = default; if ((string.IsNullOrEmpty(argumentAssetAccountId.Value) || string.IsNullOrEmpty(argumentOwnerId.Value) || string.IsNullOrEmpty(argumentIntermediaryId.Value) || !Enum.TryParse(argumentType.Value, out type)) && !optionInteractive.HasValue()) { app.ShowVersionAndHelp(); return; } var withdrawalAllowed = optionWithdrawalAllowed.HasValue(); var reporter = new ConsoleReporter(console, options.Verbose.HasValue(), false); var helper = new AccountHelper(); var account = new InvestorAssetAccount { AssetAccountId = argumentAssetAccountId.Value, OwnerId = argumentOwnerId.Value, IntermediaryId = argumentIntermediaryId.Value, Type = type, MarginAccount = optionMarginAccount.Value(), ReferenceAccount = optionReferenceAccount.Value(), BankIdentificationMargin = optionBankIdentificationMargin.Value(), BankIdentificationReference = optionBankIdentificationReference.Value(), WithdrawalAllowed = withdrawalAllowed, SettlementCurrency = optionSettlementCurrency.Value(), }; reporter.Verbose("Prototype account (from command line arguments):"); reporter.Verbose(JsonConvert.SerializeObject(account)); if (!helper.IsValid(account) || optionInteractive.HasValue()) { try { account = helper.GetValid(account); } catch (NotSupportedException ex) { throw new CommandParsingException(app, $"Operation Aborted. {ex.Message}", ex); } reporter.Verbose("Validated account (from interactive console):"); reporter.Verbose(JsonConvert.SerializeObject(account)); } options.Command = new AddInvestorAssetAccountCommand { account = account }; }); }
private async Task <int> OnExecuteAsync() { var reporter = new ConsoleReporter(PhysicalConsole.Singleton) { IsVerbose = Verbose }; var installDir = string.IsNullOrEmpty(OutputDirectory) ? Path.Combine(Directory.GetCurrentDirectory(), "packages") : Path.GetFullPath(OutputDirectory); var tempFilePath = Path.Combine(AppContext.BaseDirectory, "projectThatNeverExists.csproj"); ISettings settings = Settings.LoadDefaultSettings(tempFilePath); VersionRange versionRange; if (!string.IsNullOrEmpty(Version)) { if (!VersionRange.TryParse(Version, out versionRange)) { reporter.Error($"Invalid nuget version '{Version}'"); return(1); } } else { versionRange = Prerelease ? VersionRange.AllFloating : VersionRange.AllStableFloating; } var logger = new ConsoleNuGetLogger(reporter); var results = await RestoreRunnerEx.RunWithoutCommit(tempFilePath, installDir, PackageId, versionRange, settings, Sources, logger); var success = false; foreach (var result in results) { if (result.Result.Success) { var installedVersion = result.Result.LockFile.Libraries.FirstOrDefault(l => string.Equals(PackageId, l.Name, StringComparison.OrdinalIgnoreCase)); if (installedVersion != null) { var path = installedVersion.Path; reporter.Output($"Installed {installedVersion.Name} {installedVersion.Version}"); foreach (var file in installedVersion.Files) { reporter.Verbose("Package file: " + file); } success = true; break; } } else { foreach (var unresolved in result.Result.GetAllUnresolved()) { reporter.Warn($"Could not find a package {unresolved.Name} in the version range {unresolved.VersionRange}"); } } } if (success) { reporter.Output("Installation succeeded"); return(0); } reporter.Error("Installation failed"); return(success ? 1 : 0); }