Skip to content

Commit

Permalink
Add formatter for Caddyfile (radian-software#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
rassie committed Feb 5, 2023
1 parent a74cd99 commit e13a7ac
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apheleia.el
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ being run, for diagnostic purposes."
'((bean-format . ("bean-format"))
(black . ("black" "-"))
(brittany . ("brittany"))
(caddyfmt . ("caddy" "fmt" "-"))
(clang-format . ("clang-format"
"-assume-filename"
(or (buffer-file-name)
Expand Down Expand Up @@ -1130,6 +1131,7 @@ function: %s" command)))
(bash-ts-mode . shfmt)
(beancount-mode . bean-format)
(c++-ts-mode . clang-format)
(caddyfile-mode . caddyfmt)
(cc-mode . clang-format)
(c-mode . clang-format)
(c-ts-mode . clang-format)
Expand Down
18 changes: 18 additions & 0 deletions test/formatters/installers/caddyfmt.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ver="$(latest_release caddyserver/caddy)"

arch="$(uname -m)"
case "${arch}" in
"x86_64")
arch="amd64"
;;
"aarch64")
arch="arm64"
;;
*)
echo >&2 "unsupported architecture: ${arch}"
exit 1
;;
esac

curl -L -s "https://github.com/caddyserver/caddy/releases/download/${ver}/caddy_$(echo $ver | sed 's|^v||g')_linux_${arch}.tar.gz" | \
tar zxv -C /usr/local/bin/ caddy
4 changes: 4 additions & 0 deletions test/formatters/samplecode/caddyfmt/in.caddyfile1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
example.com {
root * /var/www
file_server
}
4 changes: 4 additions & 0 deletions test/formatters/samplecode/caddyfmt/out.caddyfile1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
example.com {
root * /var/www
file_server
}

0 comments on commit e13a7ac

Please sign in to comment.