Skip to content

Commit

Permalink
(#1310) List remembered arguments
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TheCakeIsNaOH committed Sep 23, 2022
1 parent 3892cfb commit 0383498
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public virtual IEnumerable<PackageResult> 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))
{
Expand All @@ -145,6 +146,7 @@ public virtual IEnumerable<PackageResult> 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)
Expand All @@ -169,7 +171,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(),
Expand Down Expand Up @@ -200,7 +202,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
Expand Down

0 comments on commit 0383498

Please sign in to comment.