allow to use --only with post-processors

This commit is contained in:
Adrien Delorme 2019-01-10 15:32:54 +01:00
parent 4bf3cd44fc
commit 61ade0e127
2 changed files with 5 additions and 0 deletions

View File

@ -76,6 +76,7 @@ func TestBuildOnlyFileMultipleFlags(t *testing.T) {
args := []string{
"-only=chocolate",
"-only=cherry",
"-only=apple",
filepath.Join(testFixture("build-only"), "template.json"),
}
@ -94,6 +95,9 @@ func TestBuildOnlyFileMultipleFlags(t *testing.T) {
if !fileExists("cherry.txt") {
t.Error("Expected to find cherry.txt")
}
if !fileExists("apple.txt") {
t.Error("Expected to find apple.txt")
}
}
func TestBuildExceptFileCommaFlags(t *testing.T) {

View File

@ -182,6 +182,7 @@ func (c *Core) Build(n string) (Build, error) {
for _, rawP := range rawPs {
// If we skip, ignore
rawP.OnlyExcept.Except = append(rawP.OnlyExcept.Except, c.except...)
rawP.OnlyExcept.Only = append(rawP.OnlyExcept.Only, c.only...)
if rawP.OnlyExcept.Skip(rawName) {
continue
}