Skip to content

Commit

Permalink
(chocolatey#770) Show additional message on no arguments
Browse files Browse the repository at this point in the history
This commit updates the dialog for showing package arguments
to have a notice that no arguments was found for the package in
the same dialog as normal arguments would show up with.
  • Loading branch information
AdmiringWorm committed Jan 27, 2022
1 parent 9d30975 commit 375fbce
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public IEnumerable<string> DecryptPackageArgumentsFile(string id, string version

if (string.IsNullOrEmpty(arguments))
{
_dialogService.ShowMessageAsync(
Logger.Debug(
string.Empty,
L(nameof(Resources.PackageView_UnableToFindArgumentsFile), version, id));
yield break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,18 @@ public async Task ShowArguments()
{
var decryptedArguments = _packageArgumentsService.DecryptPackageArgumentsFile(Id, Version.ToString()).ToList();

await _dialogService.ShowMessageAsync(
L(nameof(Resources.PackageViewModel_ArgumentsForPackageFormat), Title),
string.Join(Environment.NewLine, decryptedArguments));
if (decryptedArguments.Count == 0)
{
await _dialogService.ShowMessageAsync(
L(nameof(Resources.PackageViewModel_ArgumentsForPackageFormat), Title),
L(nameof(Resources.PackageViewModel_NoArgumentsAvailableForPackage)));
}
else
{
await _dialogService.ShowMessageAsync(
L(nameof(Resources.PackageViewModel_ArgumentsForPackageFormat), Title),
string.Join(Environment.NewLine, decryptedArguments));
}
}

public async Task Install()
Expand Down
9 changes: 9 additions & 0 deletions Source/ChocolateyGui.Common/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Source/ChocolateyGui.Common/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1349,4 +1349,7 @@ Please contact your System Administrator to enable this operation.</value>
<data name="PackageArgumentService_RedactedArgument" xml:space="preserve">
<value>[REDACTED ARGUMENT]</value>
</data>
<data name="PackageViewModel_NoArgumentsAvailableForPackage" xml:space="preserve">
<value>There are no Persisted Arguments available for this package!</value>
</data>
</root>

0 comments on commit 375fbce

Please sign in to comment.