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

‘_’ seems to be a bit unexpected. #265

Closed
reckless-huang opened this issue Mar 21, 2024 · 3 comments
Closed

‘_’ seems to be a bit unexpected. #265

reckless-huang opened this issue Mar 21, 2024 · 3 comments

Comments

@reckless-huang
Copy link
Contributor

kcode

apiVersion = "apps/v1"
kind = "Deployment"
metadata = {
    name = _app
    labels.app = _app
}
spec = {
    replicas = 3
    selector.matchLabels = metadata.labels
    template.metadata.labels = metadata.labels
    template.spec.containers = [
        {
            name = metadata.name
            image = "${metadata.name}:1.14.2"
            ports = [{ containerPort = 80 }]
            $protocol = "TCP"
        }
    ]
}
#_app: str = option("app") or "default"
_app = option("app", "str", False, "", "工程名")

output

apiVersion: apps/v1
kind: Deployment
metadata:
  labels: {}
spec:
  replicas: 3
  selector:
    matchLabels: {}
  template:
    metadata:
      labels: {}
    spec:
      containers:
      - image: Undefined:1.14.2
        ports:
        - containerPort: 80
        protocol: TCP

why _app not render as value

@Peefy
Copy link
Contributor

Peefy commented Mar 21, 2024

@Peefy
Copy link
Contributor

Peefy commented Mar 21, 2024

And _app needs to be defined before apiVersion. This feature will be released at kcl v0.9.0 See this PR kcl-lang/kcl#1104

@reckless-huang
Copy link
Contributor Author

And _app needs to be defined before apiVersion. This feature will be released at kcl v0.9.0 See this PR kcl-lang/kcl#1104

get it

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

No branches or pull requests

2 participants