From 0427e8afc33eb15bbf586b5da84c1b548ce28cee Mon Sep 17 00:00:00 2001 From: John McPherson Date: 2026年2月13日 16:12:16 -0800 Subject: [PATCH] Add --no-progress option --- doc/ReleaseNotes.md | 6 ++++++ doc/Settings.md | 3 +++ src/AppInstallerCLI.sln | 10 ++++++++-- src/AppInstallerCLICore/Argument.cpp | 5 +++++ src/AppInstallerCLICore/ExecutionArgs.h | 1 + src/AppInstallerCLICore/ExecutionContext.cpp | 6 +++++- src/AppInstallerCLICore/Resources.h | 1 + .../Shared/Strings/en-us/winget.resw | 3 +++ 8 files changed, 32 insertions(+), 3 deletions(-) diff --git a/doc/ReleaseNotes.md b/doc/ReleaseNotes.md index 9d09d35b32..382432c33d 100644 --- a/doc/ReleaseNotes.md +++ b/doc/ReleaseNotes.md @@ -26,6 +26,12 @@ the highest priority value (and it returned only one result) then that package w Along with the source priority change, the results from REST sources (like `msstore`) now attempt to correctly set the match criteria that factor into the result ordering. This will prevent them from being sorted to the top automatically. +## Minor Features + +### --no-progress flag + +Added a new `--no-progress` command-line flag that disables all progress reporting (progress bars and spinners). This flag is universally available on all commands and takes precedence over the `visual.progressBar` setting. Useful for automation scenarios or when running WinGet in environments where progress output is undesirable. + ## Bug Fixes diff --git a/doc/Settings.md b/doc/Settings.md index d33a8b4271..90bc94de3d 100644 --- a/doc/Settings.md +++ b/doc/Settings.md @@ -35,6 +35,9 @@ The `visual` settings involve visual elements that are displayed by WinGet Style of the progress spinner and bar that WinGet displays when not specified by arguments. In addition, all options except `disabled` send [Virtual Terminal progress](https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC) updates that any supporting terminal may display visually. +> [!NOTE] +> You can also disable progress output for a single command using the `--no-progress` flag, which takes precedence over this setting. + |Value|Description|Release| |---|---|---| |`accent` (default)|Use the [Windows Accent color](https://support.microsoft.com/en-us/windows/change-colors-in-windows-d26ef4d6-819a-581c-1581-493cfcc005fe)|1.0| diff --git a/src/AppInstallerCLI.sln b/src/AppInstallerCLI.sln index ab0f2f6c23..f2a67fd9e9 100644 --- a/src/AppInstallerCLI.sln +++ b/src/AppInstallerCLI.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 18 -VisualStudioVersion = 18.0.11205.157 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36915.13 d17.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "AppInstallerCLIPackage", "AppInstallerCLIPackage\AppInstallerCLIPackage.wapproj", "{6AA3791A-0713-4548-A357-87A323E7AC3A}" ProjectSection(ProjectDependencies) = postProject @@ -237,6 +237,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DSC", "DSC", "{40D7CA7F-EB8 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.WinGet.UnitTests", "PowerShell\Microsoft.WinGet.UnitTests\Microsoft.WinGet.UnitTests.csproj", "{5421394F-5619-4E4B-8923-F3FB30D5EFAD}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "copilot", "copilot", "{B978E358-D2BE-4FA7-A21A-6661F3744DD7}" + ProjectSection(SolutionItems) = preProject + ..\.github\copilot-instructions.md = ..\.github\copilot-instructions.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -1108,6 +1113,7 @@ Global {E5BCFF58-7D0C-4770-ABB9-AECE1027CD94} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} {40D7CA7F-EB86-4345-9641-AD27180C559D} = {7C218A3E-9BC8-48FF-B91B-BCACD828C0C9} {5421394F-5619-4E4B-8923-F3FB30D5EFAD} = {7C218A3E-9BC8-48FF-B91B-BCACD828C0C9} + {B978E358-D2BE-4FA7-A21A-6661F3744DD7} = {8D53D749-D51C-46F8-A162-9371AAA6C2E7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B6FDB70C-A751-422C-ACD1-E35419495857} diff --git a/src/AppInstallerCLICore/Argument.cpp b/src/AppInstallerCLICore/Argument.cpp index 6703130fd2..d56ecab462 100644 --- a/src/AppInstallerCLICore/Argument.cpp +++ b/src/AppInstallerCLICore/Argument.cpp @@ -283,6 +283,8 @@ namespace AppInstaller::CLI return { type, "retro"_liv, ArgTypeCategory::None, ArgTypeExclusiveSet::ProgressBarOption }; case Execution::Args::Type::RainbowStyle: return { type, "rainbow"_liv, ArgTypeCategory::None, ArgTypeExclusiveSet::ProgressBarOption }; + case Execution::Args::Type::NoProgress: + return { type, "no-progress"_liv, ArgTypeCategory::None, ArgTypeExclusiveSet::ProgressBarOption }; case Execution::Args::Type::Help: return { type, "help"_liv, APPINSTALLER_CLI_HELP_ARGUMENT_TEXT_CHAR }; case Execution::Args::Type::Info: @@ -432,6 +434,8 @@ namespace AppInstaller::CLI return Argument{ type, Resource::String::RainbowArgumentDescription, ArgumentType::Flag, Argument::Visibility::Hidden }; case Args::Type::RetroStyle: return Argument{ type, Resource::String::RetroArgumentDescription, ArgumentType::Flag, Argument::Visibility::Hidden }; + case Args::Type::NoProgress: + return Argument{ type, Resource::String::NoProgressArgumentDescription, ArgumentType::Flag, Argument::Visibility::Hidden }; case Args::Type::VerboseLogs: return Argument{ type, Resource::String::VerboseLogsArgumentDescription, ArgumentType::Flag }; case Args::Type::CustomHeader: @@ -503,6 +507,7 @@ namespace AppInstaller::CLI args.push_back(ForType(Args::Type::NoVT)); args.push_back(ForType(Args::Type::RainbowStyle)); args.push_back(ForType(Args::Type::RetroStyle)); + args.push_back(ForType(Args::Type::NoProgress)); args.push_back(ForType(Args::Type::VerboseLogs)); args.push_back(ForType(Args::Type::IgnoreWarnings)); args.emplace_back(Args::Type::DisableInteractivity, Resource::String::DisableInteractivityArgumentDescription, ArgumentType::Flag, false); diff --git a/src/AppInstallerCLICore/ExecutionArgs.h b/src/AppInstallerCLICore/ExecutionArgs.h index 895b76b2ef..eaa4eb775a 100644 --- a/src/AppInstallerCLICore/ExecutionArgs.h +++ b/src/AppInstallerCLICore/ExecutionArgs.h @@ -165,6 +165,7 @@ namespace AppInstaller::CLI::Execution NoVT, // Disable VirtualTerminal outputs RetroStyle, // Makes progress display as retro RainbowStyle, // Makes progress display as a rainbow + NoProgress, // Disables progress bar and spinner Help, // Show command usage Info, // Show general info about WinGet VerboseLogs, // Increases winget logging level to verbose diff --git a/src/AppInstallerCLICore/ExecutionContext.cpp b/src/AppInstallerCLICore/ExecutionContext.cpp index f32f6cc453..8e88ef39ff 100644 --- a/src/AppInstallerCLICore/ExecutionContext.cpp +++ b/src/AppInstallerCLICore/ExecutionContext.cpp @@ -130,7 +130,11 @@ namespace AppInstaller::CLI::Execution } // Set visual style - if (Args.Contains(Args::Type::NoVT)) + if (Args.Contains(Args::Type::NoProgress)) + { + Reporter.SetStyle(VisualStyle::Disabled); + } + else if (Args.Contains(Args::Type::NoVT)) { Reporter.SetStyle(VisualStyle::NoVT); } diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h index 4afcc159be..3fa69a1a0c 100644 --- a/src/AppInstallerCLICore/Resources.h +++ b/src/AppInstallerCLICore/Resources.h @@ -498,6 +498,7 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(NoPackageSelectionArgumentProvided); WINGET_DEFINE_RESOURCE_STRINGID(NoPackagesFoundInImportFile); WINGET_DEFINE_RESOURCE_STRINGID(NoProxyArgumentDescription); + WINGET_DEFINE_RESOURCE_STRINGID(NoProgressArgumentDescription); WINGET_DEFINE_RESOURCE_STRINGID(NoRepairInfoFound); WINGET_DEFINE_RESOURCE_STRINGID(Notes); WINGET_DEFINE_RESOURCE_STRINGID(NoUninstallInfoFound); diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw index fec301c856..ccda4e6f68 100644 --- a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw +++ b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -2867,6 +2867,9 @@ Please specify one of them using the --source option to proceed. Disable the use of proxy for this execution + + Disables the progress bar and spinner + Cannot reset {0}. This setting is controlled by policy. For more information contact your system administrator. {Locked="{0}"} The value will be replaced with the feature name

AltStyle によって変換されたページ (->オリジナル) /