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 Jan 7, 2023
1 parent d700d5c commit bca15cd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,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 Down Expand Up @@ -179,6 +180,7 @@ public virtual IEnumerable<PackageResult> list_run(ChocolateyConfiguration confi
}
}

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 @@ -203,7 +205,7 @@ public virtual IEnumerable<PackageResult> list_run(ChocolateyConfiguration confi
Tags: {9}
Software Site: {10}
Software License: {11}{12}{13}{14}{15}{16}
Description: {17}{18}
Description: {17}{18}{19}
".format_with(
package.Title.escape_curly_braces(),
package.Published.GetValueOrDefault().UtcDateTime.ToShortDateString(),
Expand Down Expand Up @@ -237,10 +239,9 @@ public virtual IEnumerable<PackageResult> list_run(ChocolateyConfiguration confi
packageLocalMetadata != null && packageLocalMetadata.BugTrackerUrl != null && !string.IsNullOrWhiteSpace(packageLocalMetadata.BugTrackerUrl.to_string()) ? "{0} Issues: {1}".format_with(Environment.NewLine, packageLocalMetadata.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 "),
packageLocalMetadata != null && packageLocalMetadata.ReleaseNotes != null && !string.IsNullOrWhiteSpace(packageLocalMetadata.ReleaseNotes.to_string()) ? "{0} Release Notes: {1}".format_with(Environment.NewLine, packageLocalMetadata.ReleaseNotes.escape_curly_braces().Replace("\n ", "\n").Replace("\n", "\n ")) : string.Empty
packageLocalMetadata != null && packageLocalMetadata.ReleaseNotes != null && !string.IsNullOrWhiteSpace(packageLocalMetadata.ReleaseNotes.to_string()) ? "{0} Release Notes: {1}".format_with(Environment.NewLine, packageLocalMetadata.ReleaseNotes.escape_curly_braces().Replace("\n ", "\n").Replace("\n", "\n ")) : string.Empty,
packageArgumentsUnencrypted != null ? packageArgumentsUnencrypted : string.Empty
));


}
else
{
Expand Down

0 comments on commit bca15cd

Please sign in to comment.