winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a56372ba05d8f4423cb7cf5be0b5c0bacb445ca3
parent dea9a204d8dfbb3fe3e4dbfe54bf94251a4d8bfe
Author: Kaleb Luedtke <jluedtk@jci.com>
Date:   Wed,  6 Jul 2022 15:51:32 -0500

Feat: Wait upon command completion (#2236)


Diffstat:
Msrc/AppInstallerCLICore/Argument.cpp | 1+
Msrc/AppInstallerCLICore/Command.cpp | 4++++
Msrc/AppInstallerCLICore/Commands/RootCommand.cpp | 7++++++-
Msrc/AppInstallerCLICore/ExecutionReporter.cpp | 7+++++++
Msrc/AppInstallerCLICore/ExecutionReporter.h | 3+++
Msrc/AppInstallerCLICore/Resources.h | 1+
Msrc/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw | 3+++
7 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/AppInstallerCLICore/Argument.cpp b/src/AppInstallerCLICore/Argument.cpp @@ -105,6 +105,7 @@ namespace AppInstaller::CLI void Argument::GetCommon(std::vector<Argument>& args) { args.push_back(ForType(Args::Type::Help)); + args.push_back(ForType(Args::Type::Wait)); args.push_back(ForType(Args::Type::NoVT)); args.push_back(ForType(Args::Type::RainbowStyle)); args.push_back(ForType(Args::Type::RetroStyle)); diff --git a/src/AppInstallerCLICore/Command.cpp b/src/AppInstallerCLICore/Command.cpp @@ -808,6 +808,10 @@ namespace AppInstaller::CLI { ExecuteInternal(context); } + if (context.Args.Contains(Execution::Args::Type::Wait)) + { + context.Reporter.PromptForEnter(); + } } void Command::ValidateArgumentsInternal(Execution::Args&) const diff --git a/src/AppInstallerCLICore/Commands/RootCommand.cpp b/src/AppInstallerCLICore/Commands/RootCommand.cpp @@ -160,6 +160,11 @@ namespace AppInstaller::CLI { ExecuteInternal(context); } + + if (context.Args.Contains(Execution::Args::Type::Wait)) + { + context.Reporter.PromptForEnter(); + } } void RootCommand::ExecuteInternal(Execution::Context& context) const @@ -198,7 +203,7 @@ namespace AppInstaller::CLI } else if (context.Args.Contains(Execution::Args::Type::ListVersions)) { - context.Reporter.Info() << 'v' << Runtime::GetClientVersion(); + context.Reporter.Info() << 'v' << Runtime::GetClientVersion() << std::endl; } else { diff --git a/src/AppInstallerCLICore/ExecutionReporter.cpp b/src/AppInstallerCLICore/ExecutionReporter.cpp @@ -156,6 +156,13 @@ namespace AppInstaller::CLI::Execution } } + void Reporter::PromptForEnter(Level level) + { + auto out = GetOutputStream(level); + out << std::endl << Resource::String::PressEnterToContinue << std::endl; + m_in.get(); + } + void Reporter::ShowIndefiniteProgress(bool running) { if (m_spinner) diff --git a/src/AppInstallerCLICore/ExecutionReporter.h b/src/AppInstallerCLICore/ExecutionReporter.h @@ -99,6 +99,9 @@ namespace AppInstaller::CLI::Execution // Prompts the user, return true if they consented. bool PromptForBoolResponse(Resource::LocString message, Level level = Level::Info); + // Prompts the user, continues when Enter is pressed + void PromptForEnter(Level level = Level::Info); + // Used to show indefinite progress. Currently an indefinite spinner is the form of // showing indefinite progress. // running: shows indefinite progress if set to true, stops indefinite progress if set to false diff --git a/src/AppInstallerCLICore/Resources.h b/src/AppInstallerCLICore/Resources.h @@ -219,6 +219,7 @@ namespace AppInstaller::CLI::Resource WINGET_DEFINE_RESOURCE_STRINGID(PortableRegistryCollisionOverridden); WINGET_DEFINE_RESOURCE_STRINGID(PositionArgumentDescription); WINGET_DEFINE_RESOURCE_STRINGID(PreserveArgumentDescription); + WINGET_DEFINE_RESOURCE_STRINGID(PressEnterToContinue); WINGET_DEFINE_RESOURCE_STRINGID(PrivacyStatement); WINGET_DEFINE_RESOURCE_STRINGID(ProductCodeArgumentDescription); WINGET_DEFINE_RESOURCE_STRINGID(PromptOptionNo); diff --git a/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw b/src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw @@ -1284,6 +1284,9 @@ Please specify one of them using the `--source` option to proceed.</value> <data name="PurgeArgumentDescription" xml:space="preserve"> <value>Deletes all files and directories in the package directory (portable)</value> </data> + <data name="PressEnterToContinue" xml:space="preserve"> + <value>Press Enter to continue . . .</value> + </data> <data name="RenameArgumentDescription" xml:space="preserve"> <value>The value to rename the executable file (portable)</value> </data>