Skip to content

Conversation

@Markliniubility
Copy link
Contributor

@Markliniubility Markliniubility commented Oct 26, 2023

#35173

Before:

> dotnet tool install GitVersion.Tool --global --prerelease --verbosity quiet
Tool 'XXXXXXXXX' (version '999.999.999.999') was successfully installed....

After:

> dotnet tool install GitVersion.Tool --global --prerelease --verbosity quiet
>

I have edited the VerbosityOption as currently the default option is quiet; however, according to the online documentation, the default option should be minimal
20231109031026
I know this it dotnet build but they share the same LoggerVerbosity documentation.

@ghost ghost added Area-Tools untriaged Request triage from a team member labels Oct 26, 2023
@Markliniubility Markliniubility changed the title [Issue #35173] --verbosity quiet suppress success message [Issue #35173] WIP: --verbosity quiet suppress success message Oct 27, 2023
@Markliniubility Markliniubility marked this pull request as draft October 27, 2023 06:48
Markliniubility and others added 5 commits November 6, 2023 23:00
This will affect ~.2% of test work items
…ld 20231024.9

Microsoft.WindowsDesktop.App.Ref , Microsoft.WindowsDesktop.App.Runtime.win-x64 , VS.Redist.Common.WindowsDesktop.SharedFramework.x64.8.0 , VS.Redist.Common.WindowsDesktop.TargetingPack.x64.8.0
 From Version 8.0.0-rtm.23524.7 -> To Version 8.0.0
…net#36467)

[release/8.0.1xx] Update dependencies from dotnet/windowsdesktop
- Coherency Updates:
  - Microsoft.NET.Sdk.WindowsDesktop: from 8.0.0-rtm.23524.4 to 8.0.0-rtm.23524.6 (parent: Microsoft.WindowsDesktop.App.Ref)
@Markliniubility Markliniubility changed the base branch from main to release/8.0.2xx November 7, 2023 07:32
@Markliniubility Markliniubility changed the title [Issue #35173] WIP: --verbosity quiet suppress success message [Issue #35173] --verbosity quiet suppress success message Nov 9, 2023
@Markliniubility Markliniubility marked this pull request as ready for review November 9, 2023 11:13
Copy link
Contributor

@JL03-Yue JL03-Yue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work! Thanks for your contributions!

Comment on lines 172 to 181
if (_verbosity.IsQuiet())
{
return 0;
}
_reporter.WriteLine(
string.Format(
LocalizableStrings.InstallationSucceeded,
string.Join(", ", package.Commands.Select(c => c.Name)),
package.Id,
package.Version.ToNormalizedString()).Green());
string.Format(
LocalizableStrings.InstallationSucceeded,
string.Join(", ", package.Commands.Select(c => c.Name)),
package.Id,
package.Version.ToNormalizedString()).Green());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if !(_verbosity.IsQuiet())
{
        _reporter.WriteLine(
        string.Format(
            LocalizableStrings.InstallationSucceeded,
            string.Join(", ", package.Commands.Select(c => c.Name)),
            package.Id,
            package.Version.ToNormalizedString()).Green());
}
return 0;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The affirmative condition might be a better choice. Thanks for pointing it out!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the if (!_verbosity.IsQuiet()) option better, too. Nice to have just one exit point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also (tiny nit) it'd be nice to have one blank line on either side of the if block.

Copy link
Contributor

@Forgind Forgind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

q,
minimal,
m,
quiet,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you undo this move? They were previously sorted in order of verbosity, and now they aren't sorted at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really good point. I was trying to make minimal the default option. Let me try to find other ways to make it default. Thanks!

Comment on lines 172 to 181
if (_verbosity.IsQuiet())
{
return 0;
}
_reporter.WriteLine(
string.Format(
LocalizableStrings.InstallationSucceeded,
string.Join(", ", package.Commands.Select(c => c.Name)),
package.Id,
package.Version.ToNormalizedString()).Green());
string.Format(
LocalizableStrings.InstallationSucceeded,
string.Join(", ", package.Commands.Select(c => c.Name)),
package.Id,
package.Version.ToNormalizedString()).Green());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the if (!_verbosity.IsQuiet()) option better, too. Nice to have just one exit point.

Comment on lines 172 to 181
if (_verbosity.IsQuiet())
{
return 0;
}
_reporter.WriteLine(
string.Format(
LocalizableStrings.InstallationSucceeded,
string.Join(", ", package.Commands.Select(c => c.Name)),
package.Id,
package.Version.ToNormalizedString()).Green());
string.Format(
LocalizableStrings.InstallationSucceeded,
string.Join(", ", package.Commands.Select(c => c.Name)),
package.Id,
package.Version.ToNormalizedString()).Green());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also (tiny nit) it'd be nice to have one blank line on either side of the if block.

@Markliniubility
Copy link
Contributor Author

Looks good to me!

Thank you for your review! Fixed!

@Forgind
Copy link
Contributor

Forgind commented Nov 28, 2023

Looked at a couple failing legs, and they do seem related to your change. I'm currently leaning towards suggesting that we can just leave the default where it was and have the output change. I think changing the default there changed it for a lot of other commands...

Couple failing tests:
ItCanInvokeDiagramDirective didn't expect verbosity in stdout
ItDoesNotShowImportantLevelMessageByDefault expected quiet verbosity (no "important" text)

@Markliniubility
Copy link
Contributor Author

Looked at a couple failing legs, and they do seem related to your change. I'm currently leaning towards suggesting that we can just leave the default where it was and have the output change. I think changing the default there changed it for a lot of other commands...

Couple failing tests:

ItCanInvokeDiagramDirective didn't expect verbosity in stdout

ItDoesNotShowImportantLevelMessageByDefault expected quiet verbosity (no "important" text)

Thanks for the note, and fixed! Yes that's certainly a very good point. It triggers failures in too many other places: leaving the default as it was is a better idea.

Copy link
Contributor

@Forgind Forgind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy; thanks for making these changes!

public void WhenRunWithExactVersionItShouldSucceed()
{
ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion}");
ParseResult result = Parser.Instance.Parse($"dotnet tool install -g {PackageId} --version {PackageVersion} --verbosity minimal");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having reverted the default, do you still need to explicitly set verbosity to minimal in all these tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Because by default verbosity is quiet (first element in the verbosity Enum), which has no output unless there is an error.

@marcpopMSFT marcpopMSFT merged commit b61fe9c into dotnet:release/8.0.2xx Dec 5, 2023
@marcpopMSFT
Copy link
Member

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Tools untriaged Request triage from a team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants