From 10bcd79d0bf9b2b1b5c0c157587927cf4c4c7ca6 Mon Sep 17 00:00:00 2001 From: TheCakeIsNaOH Date: Sun, 6 Mar 2022 15:33:42 -0600 Subject: [PATCH] (#1310) List remembered arguments This adds the listing of remembered arguments to the list/info commands It only grabs the arguments when --local-only is specified, then decrypts and outputs them. Requires --verbose to be listed on the command line. --- src/chocolatey/infrastructure.app/services/NugetService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index d6a9a14c4..fe1376000 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -130,6 +130,7 @@ public virtual IEnumerable list_run(ChocolateyConfiguration confi foreach (var pkg in NugetList.GetPackages(config, _nugetLogger)) { var package = pkg; // for lamda access + string packageArgumentsUnencrypted = null; if (!string.IsNullOrWhiteSpace(config.Version)) { @@ -146,6 +147,7 @@ public virtual IEnumerable list_run(ChocolateyConfiguration confi package.OverrideOriginalVersion(packageInfo.VersionOverride); } } + packageArgumentsUnencrypted = "\n Remembered Package Arguments: " + (packageInfo.Arguments.contains(" --") && packageInfo.Arguments.to_string().Length > 4 ? packageInfo.Arguments : NugetEncryptionUtility.DecryptString(packageInfo.Arguments)); } if (!config.QuietOutput) @@ -170,7 +172,7 @@ Package url Tags: {8} Software Site: {9} Software License: {10}{11}{12}{13}{14}{15} - Description: {16}{17} + Description: {16}{17}{18} ".format_with( package.Title.escape_curly_braces(), package.Published.GetValueOrDefault().UtcDateTime.ToShortDateString(), @@ -201,7 +203,8 @@ Package url package.BugTrackerUrl != null && !string.IsNullOrWhiteSpace(package.BugTrackerUrl.to_string()) ? "{0} Issues: {1}".format_with(Environment.NewLine, package.BugTrackerUrl.to_string()) : string.Empty, package.Summary != null && !string.IsNullOrWhiteSpace(package.Summary.to_string()) ? "{0} Summary: {1}".format_with(Environment.NewLine, package.Summary.escape_curly_braces().to_string()) : string.Empty, package.Description.escape_curly_braces().Replace("\n ", "\n").Replace("\n", "\n "), - package.ReleaseNotes != null && !string.IsNullOrWhiteSpace(package.ReleaseNotes.to_string()) ? "{0} Release Notes: {1}".format_with(Environment.NewLine, package.ReleaseNotes.escape_curly_braces().Replace("\n ", "\n").Replace("\n", "\n ")) : string.Empty + package.ReleaseNotes != null && !string.IsNullOrWhiteSpace(package.ReleaseNotes.to_string()) ? "{0} Release Notes: {1}".format_with(Environment.NewLine, package.ReleaseNotes.escape_curly_braces().Replace("\n ", "\n").Replace("\n", "\n ")) : string.Empty, + packageArgumentsUnencrypted != null ? packageArgumentsUnencrypted : string.Empty )); } else