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

[Enhancement] The output code style of override API can be more compact #588

Closed
Peefy opened this issue Jun 28, 2023 · 0 comments · Fixed by #590
Closed

[Enhancement] The output code style of override API can be more compact #588

Peefy opened this issue Jun 28, 2023 · 0 comments · Fixed by #590
Assignees
Labels
api Issues or PRs related to kcl rust native APIs and multi-lang APIs enhancement New feature or request

Comments

@Peefy
Copy link
Contributor

Peefy commented Jun 28, 2023

Enhancement

In the current KCL version, for the following code (main.k)

schema Config:
    a: {str:}

c = Config {
    a = {b = 1}
}

Run the following code:

kcl main.k -O c.a.c=2 -d

We can get the code as follows:

schema Config:
    a: {str:}

c = Config {
    a = {b = 1}
    a.c = 2
}

This issue aims to improve the compactness of KCL override code by modifying the code as much as possible according to the override path. For example, for the above code, after being overridden, the following code is output

schema Config:
    a: {str:}

c = Config {
    a = {
        b = 1
        c = 2 # Avoid outputting common config paths `a` for `a.b` and `a.c`
    }
}
@Peefy Peefy added enhancement New feature or request api Issues or PRs related to kcl rust native APIs and multi-lang APIs labels Jun 28, 2023
@Peefy Peefy added this to the v0.5.0 Release milestone Jun 28, 2023
@Peefy Peefy self-assigned this Jun 28, 2023
@Peefy Peefy closed this as completed in #590 Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues or PRs related to kcl rust native APIs and multi-lang APIs enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant