Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverrideFile API should add a param indicating whether to override by an equal sign or a colon #1346

Closed
zhuxw opened this issue May 20, 2024 · 1 comment · Fixed by #1358
Closed
Assignees

Comments

@zhuxw
Copy link

zhuxw commented May 20, 2024

Enhancement

Currently, if a new config is added to a .k file using the OverrideFile API, the equal sign will be used. For example:

// Overriding prod/main.k:
// before override
container: Container {
}

// after override
container: Container {
   envs = {
        "FOO": "BAR"
   }
}

But sometimes this behavior is not expected, because the .k file is to be compiled together with other .k files. For example:

// base/base.k:  already exists some envs
container: Container {
    envs: {
         "aaa": "bbb"
    }
}

If prod/main.k is supposed to be compiled together with base/base.k, overriding using the equal sign will drop all the existing envs in base/base.k.

The expected behavior is that the OverrideFile API providing a new param, indicating whether to use equal sign or colon. For example:

overrideUsingColon := true
kclapi.OverrideFile(file, overrides, deps, overrideUsingColon)
@Peefy
Copy link
Contributor

Peefy commented May 21, 2024

I think we can extend the spec https://www.kcl-lang.io/docs/user_docs/guides/automation#2-use-kcl-cli-for-automation with the : and += attribute operators.
cc @zong-zhe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants