Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ACTIONDATA
ACTIONSTART
addfile
addmanifest
addpin
addportablefile
addstore
admins
Expand Down Expand Up @@ -94,6 +95,7 @@ cpprestsdk
cppwinrt
CPRWL
createnew
createpintable
createportabletable
createtables
cref
Expand Down Expand Up @@ -253,6 +255,7 @@ INVALIDARG
INVALIDSID
iomanip
iostream
IPinning
IPortable
ipmo
ISAPPROVEDFOROUTPUT
Expand Down Expand Up @@ -389,6 +392,7 @@ pfp
PGP
php
PII
pinningindex
pipssource
PKCS
placeholders
Expand Down Expand Up @@ -441,10 +445,12 @@ regex
regexp
removefile
removemanifest
removepin
removeportablefile
repolibtest
requeue
rescap
resetpins
resheader
resmimetype
RESOLVESOURCE
Expand Down Expand Up @@ -623,6 +629,7 @@ Unregisters
untimes
updatefile
updatemanifest
updatepin
updateportablefile
UPLEVEL
upvote
Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCLICore/AppInstallerCLICore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@
<ClCompile Include="Workflows\ImportExportFlow.cpp" />
<ClCompile Include="Workflows\MsiInstallFlow.cpp" />
<ClCompile Include="Workflows\MSStoreInstallerHandler.cpp" />
<ClCompile Include="Workflows\PinFlow.cpp" />
<ClCompile Include="Workflows\PortableFlow.cpp" />
<ClCompile Include="Workflows\PromptFlow.cpp" />
<ClCompile Include="Workflows\SettingsFlow.cpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,11 @@
<ClCompile Include="PortableInstaller.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Workflows\PinFlow.cpp">
<Filter>Workflows</Filter>
</ClCompile>
<ClCompile Include="Commands\PinCommand.cpp">
<Filter>Source Files</Filter>
<Filter>Commands</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down
127 changes: 101 additions & 26 deletions src/AppInstallerCLICore/Commands/PinCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,26 @@ namespace AppInstaller::CLI

void PinAddCommand::Complete(Execution::Context& context, Args::Type valueType) const
{
context <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed);

switch (valueType)
{
case Args::Type::Query:
case Args::Type::Id:
case Args::Type::Name:
case Args::Type::Moniker:
case Args::Type::Source:
case Execution::Args::Type::Query:
context <<
Workflow::RequireCompletionWordNonEmpty <<
Workflow::SearchSourceForManyCompletion <<
Workflow::CompleteWithMatchedField;
break;
case Execution::Args::Type::Id:
case Execution::Args::Type::Name:
case Execution::Args::Type::Moniker:
case Execution::Args::Type::Source:
case Execution::Args::Type::Tag:
case Execution::Args::Type::Command:
context <<
Workflow::CompleteWithSingleSemanticsForValue(valueType);
Workflow::CompleteWithSingleSemanticsForValueUsingExistingSource(valueType);
break;
}
}
Expand All @@ -105,8 +116,17 @@ namespace AppInstaller::CLI

void PinAddCommand::ExecuteInternal(Execution::Context& context) const
{
// TODO
Command::ExecuteInternal(context);
context <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed) <<
Workflow::SearchSourceForSingle <<
Workflow::HandleSearchResultFailures <<
Workflow::EnsureOneMatchFromSearchResult(false) <<
Workflow::GetInstalledPackageVersion <<
Workflow::ReportPackageIdentity <<
Workflow::OpenPinningIndex() <<
Workflow::SearchPin <<
Workflow::AddPin;
}

std::vector<Argument> PinRemoveCommand::GetArguments() const
Expand Down Expand Up @@ -137,15 +157,26 @@ namespace AppInstaller::CLI

void PinRemoveCommand::Complete(Execution::Context& context, Args::Type valueType) const
{
context <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed);

switch (valueType)
{
case Args::Type::Query:
case Args::Type::Id:
case Args::Type::Name:
case Args::Type::Moniker:
case Args::Type::Source:
case Execution::Args::Type::Query:
context <<
Workflow::CompleteWithSingleSemanticsForValue(valueType);
Workflow::RequireCompletionWordNonEmpty <<
Workflow::SearchSourceForManyCompletion <<
Workflow::CompleteWithMatchedField;
break;
case Execution::Args::Type::Id:
case Execution::Args::Type::Name:
case Execution::Args::Type::Moniker:
case Execution::Args::Type::Source:
case Execution::Args::Type::Tag:
case Execution::Args::Type::Command:
context <<
Workflow::CompleteWithSingleSemanticsForValueUsingExistingSource(valueType);
break;
}
}
Expand All @@ -157,8 +188,17 @@ namespace AppInstaller::CLI

void PinRemoveCommand::ExecuteInternal(Execution::Context& context) const
{
// TODO
Command::ExecuteInternal(context);
context <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed) <<
Workflow::SearchSourceForSingle <<
Workflow::HandleSearchResultFailures <<
Workflow::EnsureOneMatchFromSearchResult(false) <<
Workflow::GetInstalledPackageVersion <<
Workflow::ReportPackageIdentity <<
Workflow::OpenPinningIndex() <<
Workflow::SearchPin <<
Workflow::RemovePin;
}

std::vector<Argument> PinListCommand::GetArguments() const
Expand Down Expand Up @@ -189,15 +229,26 @@ namespace AppInstaller::CLI

void PinListCommand::Complete(Execution::Context& context, Args::Type valueType) const
{
context <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed);

switch (valueType)
{
case Args::Type::Query:
case Args::Type::Id:
case Args::Type::Name:
case Args::Type::Moniker:
case Args::Type::Source:
case Execution::Args::Type::Query:
context <<
Workflow::RequireCompletionWordNonEmpty <<
Workflow::SearchSourceForManyCompletion <<
Workflow::CompleteWithMatchedField;
break;
case Execution::Args::Type::Id:
case Execution::Args::Type::Name:
case Execution::Args::Type::Moniker:
case Execution::Args::Type::Source:
case Execution::Args::Type::Tag:
case Execution::Args::Type::Command:
context <<
Workflow::CompleteWithSingleSemanticsForValue(valueType);
Workflow::CompleteWithSingleSemanticsForValueUsingExistingSource(valueType);
break;
}
}
Expand All @@ -209,14 +260,20 @@ namespace AppInstaller::CLI

void PinListCommand::ExecuteInternal(Execution::Context& context) const
{
// TODO
Command::ExecuteInternal(context);
context <<
Workflow::OpenPinningIndex(/* readOnly */ true) <<
Workflow::GetAllPins <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed) <<
Workflow::CrossReferencePinsWithSource <<
Workflow::ReportPins;
}

std::vector<Argument> PinResetCommand::GetArguments() const
{
return {
Argument::ForType(Args::Type::Force),
Argument::ForType(Args::Type::Source),
};
}

Expand All @@ -237,7 +294,25 @@ namespace AppInstaller::CLI

void PinResetCommand::ExecuteInternal(Execution::Context& context) const
{
// TODO
Command::ExecuteInternal(context);

if (context.Args.Contains(Execution::Args::Type::Force))
{
context <<
Workflow::OpenPinningIndex() <<
Workflow::ResetAllPins;
}
else
{
AICLI_LOG(CLI, Info, << "--force argument is not present");
context.Reporter.Info() << Resource::String::PinResetUseForceArg << std::endl;

context <<
Workflow::OpenPinningIndex(/* readOnly */ true) <<
Workflow::GetAllPins <<
Workflow::OpenSource() <<
Workflow::OpenCompositeSource(Repository::PredefinedSource::Installed) <<
Workflow::CrossReferencePinsWithSource <<
Workflow::ReportPins;
}
}
}
19 changes: 19 additions & 0 deletions src/AppInstallerCLICore/ExecutionContextData.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <winget/RepositorySource.h>
#include <winget/Manifest.h>
#include <winget/ARPCorrelation.h>
#include <winget/Pin.h>
#include "CompletionData.h"
#include "PackageCollection.h"
#include "PortableInstaller.h"
Expand All @@ -16,6 +17,10 @@
#include <variant>
#include <vector>

namespace AppInstaller::Repository::Microsoft
{
struct PinningIndex;
}

namespace AppInstaller::CLI::Execution
{
Expand Down Expand Up @@ -55,6 +60,8 @@ namespace AppInstaller::CLI::Execution
AllowedArchitectures,
AllowUnknownScope,
PortableInstaller,
PinningIndex,
Pins,
Max
};

Expand Down Expand Up @@ -229,5 +236,17 @@ namespace AppInstaller::CLI::Execution
{
using value_t = CLI::Portable::PortableInstaller;
};

template <>
struct DataMapping<Data::PinningIndex>
{
using value_t = std::shared_ptr<Repository::Microsoft::PinningIndex>;
};

template <>
struct DataMapping<Data::Pins>
{
using value_t = std::vector<Pinning::Pin>;
};
}
}
11 changes: 11 additions & 0 deletions src/AppInstallerCLICore/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,25 @@ namespace AppInstaller::CLI::Resource
WINGET_DEFINE_RESOURCE_STRINGID(PinAddBlockingArgumentDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinAddCommandLongDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinAddCommandShortDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinAdded);
WINGET_DEFINE_RESOURCE_STRINGID(PinAlreadyExists);
WINGET_DEFINE_RESOURCE_STRINGID(PinCannotOpenIndex);
WINGET_DEFINE_RESOURCE_STRINGID(PinCommandLongDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinCommandShortDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinDoesNotExist);
WINGET_DEFINE_RESOURCE_STRINGID(PinExistsOverwriting);
WINGET_DEFINE_RESOURCE_STRINGID(PinExistsUseForceArg);
WINGET_DEFINE_RESOURCE_STRINGID(PinListCommandLongDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinListCommandShortDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinNoPinsExist);
WINGET_DEFINE_RESOURCE_STRINGID(PinRemoveCommandLongDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinRemoveCommandShortDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinResetCommandLongDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinResetCommandShortDescription);
WINGET_DEFINE_RESOURCE_STRINGID(PinResetSuccessful);
WINGET_DEFINE_RESOURCE_STRINGID(PinResettingAll);
WINGET_DEFINE_RESOURCE_STRINGID(PinResetUseForceArg);
WINGET_DEFINE_RESOURCE_STRINGID(PinType);
WINGET_DEFINE_RESOURCE_STRINGID(PoliciesDisabled);
WINGET_DEFINE_RESOURCE_STRINGID(PoliciesEnabled);
WINGET_DEFINE_RESOURCE_STRINGID(PoliciesPolicy);
Expand Down
Loading