Skip to content

Commit

Permalink
Allow --accept-source-agreements with local manifests (#3573)
Browse files Browse the repository at this point in the history
* Allow --accept-source-agreements with local manifests

* Make flags more granular
  • Loading branch information
Trenly authored Oct 11, 2023
1 parent 95dfc27 commit 18df795
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/AppInstallerCLICore/Argument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace AppInstaller::CLI
case Execution::Args::Type::Command:
return { type, "command"_liv, "cmd"_liv, ArgTypeCategory::PackageQuery | ArgTypeCategory::SinglePackageQuery };
case Execution::Args::Type::Source:
return { type, "source"_liv, 's', ArgTypeCategory::Source };
return { type, "source"_liv, 's', ArgTypeCategory::QuerySource };
case Execution::Args::Type::Count:
return { type, "count"_liv, 'n', ArgTypeCategory::PackageQuery | ArgTypeCategory::SinglePackageQuery };
case Execution::Args::Type::Exact:
Expand Down Expand Up @@ -219,11 +219,11 @@ namespace AppInstaller::CLI
return { type, "force"_liv, ArgTypeCategory::CopyFlagToSubContext };

case Execution::Args::Type::DependencySource:
return { type, "dependency-source"_liv, ArgTypeCategory::Source };
return { type, "dependency-source"_liv, ArgTypeCategory::ExtendedSource };
case Execution::Args::Type::CustomHeader:
return { type, "header"_liv, ArgTypeCategory::Source };
return { type, "header"_liv, ArgTypeCategory::QuerySource };
case Execution::Args::Type::AcceptSourceAgreements:
return { type, "accept-source-agreements"_liv, ArgTypeCategory::Source };
return { type, "accept-source-agreements"_liv, ArgTypeCategory::ExtendedSource };

case Execution::Args::Type::ToolVersion:
return { type, "version"_liv, 'v' };
Expand Down Expand Up @@ -459,7 +459,7 @@ namespace AppInstaller::CLI

// If a manifest is specified, we cannot also have arguments for searching
if (WI_IsFlagSet(categories, ArgTypeCategory::Manifest) &&
WI_IsAnyFlagSet(categories, ArgTypeCategory::PackageQuery | ArgTypeCategory::Source))
WI_IsAnyFlagSet(categories, ArgTypeCategory::PackageQuery | ArgTypeCategory::QuerySource))
{
throw CommandException(Resource::String::BothManifestAndSearchQueryProvided);
}
Expand Down
10 changes: 7 additions & 3 deletions src/AppInstallerCLICore/Argument.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ namespace AppInstaller::CLI
// Arguments for installer or uninstaller behavior, which do not work for multiple packages.
// E.g.: --override
SingleInstallerBehavior = 0x20,
// Arguments for selecting or interacting with the source.
// E.g.: --accept-source-agreements
Source = 0x40,
// Arguments for selecting or interacting with the source used for initial querying
// E.g.: --header
QuerySource = 0x40,
// Arguments that only make sense when talking about multiple packages
MultiplePackages = 0x80,
// Flag arguments that should be copied over when creating a sub-context
CopyFlagToSubContext = 0x100,
// Arguments with associated values that should be copied over when creating a sub-context
CopyValueToSubContext = 0x200,
// Arguments for selecting or interacting with dependencies or setting specific source behaviors
// E.g.: --dependency-source
// E.g.: --accept-source-agreements
ExtendedSource = 0x400,
};

DEFINE_ENUM_FLAG_OPERATORS(ArgTypeCategory);
Expand Down

0 comments on commit 18df795

Please sign in to comment.