diff options
| author | Matus Goljer <matus.goljer@gmail.com> | 2025-05-20 01:42:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-19 16:42:52 -0700 |
| commit | 7eaaf3f45703d49e494f6dd0555633cf6b355817 (patch) | |
| tree | 1613cd36f9e5bef64fecded479e7767629c9c18d | |
| parent | 57d9ab3f909109a093ae69730d8666d8202898ab (diff) | |
feat: add nomad formatter (#361)
This is a more specific formatter than `hclfmt` for nomad files.
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | apheleia-formatters.el | 2 | ||||
| -rw-r--r-- | test/formatters/installers/nomad.bash | 5 | ||||
| -rw-r--r-- | test/formatters/samplecode/nomad/in.nomad | 20 | ||||
| -rw-r--r-- | test/formatters/samplecode/nomad/out.nomad | 20 |
5 files changed, 49 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e0c6db9..c09323b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ The format is based on [Keep a Changelog]. ### Formatters * Format Bazel files according to their type +* `nomad fmt` official formatter for + [HashiCorp Nomad](https://developer.hashicorp.com/nomad) ([#361]). [#299]: https://github.com/radian-software/apheleia/issues/299 diff --git a/apheleia-formatters.el b/apheleia-formatters.el index 75374fa..c49c18e 100644 --- a/apheleia-formatters.el +++ b/apheleia-formatters.el @@ -104,6 +104,7 @@ (mix-format . ("apheleia-from-project-root" ".formatter.exs" "apheleia-mix-format" filepath)) (nixfmt . ("nixfmt")) + (nomad . ("nomad" "fmt" "-")) (ocamlformat . ("ocamlformat" "-" "--name" filepath "--enable-outside-detected-project")) (ocp-indent . ("ocp-indent")) @@ -370,6 +371,7 @@ rather than using this system." (nasm-mode . asmfmt) (nix-mode . nixfmt) (nix-ts-mode . nixfmt) + (nomad-mode . nomad) (perl-mode . perltidy) (php-mode . phpcs) (purescript-mode . purs-tidy) diff --git a/test/formatters/installers/nomad.bash b/test/formatters/installers/nomad.bash new file mode 100644 index 0000000..80215cc --- /dev/null +++ b/test/formatters/installers/nomad.bash @@ -0,0 +1,5 @@ +curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - +echo "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/nomad.list + +apt-get update +apt-get install -y nomad diff --git a/test/formatters/samplecode/nomad/in.nomad b/test/formatters/samplecode/nomad/in.nomad new file mode 100644 index 0000000..95cac05 --- /dev/null +++ b/test/formatters/samplecode/nomad/in.nomad @@ -0,0 +1,20 @@ +job "mongo-jwt" { + namespace = "default" + + group "db" { + network { + port "db" { + static = 27017 + } + } + +task "mongo" { +driver = "docker" + + config { + image = "mongo:7" + ports = ["db"] + } + } + } +} diff --git a/test/formatters/samplecode/nomad/out.nomad b/test/formatters/samplecode/nomad/out.nomad new file mode 100644 index 0000000..3107f5b --- /dev/null +++ b/test/formatters/samplecode/nomad/out.nomad @@ -0,0 +1,20 @@ +job "mongo-jwt" { + namespace = "default" + + group "db" { + network { + port "db" { + static = 27017 + } + } + + task "mongo" { + driver = "docker" + + config { + image = "mongo:7" + ports = ["db"] + } + } + } +} |
