Skip to content

Commit

Permalink
feat: Allow a container-clean api-path of "none"
Browse files Browse the repository at this point in the history
When provided "none", the container should clean just
non-API-specific files.
  • Loading branch information
jskeet committed Dec 16, 2024
1 parent d354394 commit 1402395
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace Google.Cloud.Tools.ReleaseManager.ContainerCommands;
/// - repo-root: path to the root of the clone
/// - api-path: path to the API to clean generated files from, e.g. google/cloud/functions/v2
/// This is optional; when omitted, all configured APIs are cleaned.
/// The special value of "none" means "clean non-API-specific files only".
/// </summary>
internal class CleanCommand : IContainerCommand
{
Expand All @@ -36,7 +37,12 @@ public int Execute(Dictionary<string, string> options)
var catalog = ApiCatalog.Load(rootLayout);

List<ApiMetadata> apis;
if (apiPath is not null)
// No APIs, just clean non-API-specific.
if (apiPath == "none")
{
apis = new();
}
else if (apiPath is not null)
{
apis = new List<ApiMetadata>();
var targetApi = catalog.Apis.SingleOrDefault(api => api.ProtoPath == apiPath);
Expand Down

0 comments on commit 1402395

Please sign in to comment.