Skip to content

Pretty printer for the templates #767

@Fuco1

Description

@Fuco1

There is nomad fmt but no nomad-pack fmt. Is this something feasible to have? It's quite annoying to be required to manually format files in your editor after all the years of nomad fmt just doing it for you T_T.

99% of the problem would be solved by some alternative syntax for [[ var "foo" . ]] inside something which already is a string, for example

service {
  name = "job[[ var "job_suffix" . ]]"
}

because now the quotes split the name value into two strings and some job_suffix random token which nomad fmt can't parse The old syntax

service {
  name = "job[[ .job_suffix ]]"
}

is fine, because there are no quotes to break the nomad parser. Is this something which could be maybe reconsidered? Levant also used interpolation like this and I basically very rarely had formatting issues. Probably to be fair 95% of use case is just people templating the job name since that's not possible with variables 🤷

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions