mirror of
https://github.com/vale981/apheleia
synced 2025-03-04 17:11:40 -05:00
Add shfmt (#90)
* feat: add shfmt Add support for shfmt * Handle multiple architectures Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
This commit is contained in:
parent
982df5a2e0
commit
b5dbab53ea
5 changed files with 29 additions and 1 deletions
|
@ -933,6 +933,7 @@ being run, for diagnostic purposes."
|
|||
"--enable-outside-detected-project"))
|
||||
(phpcs . ("apheleia-phpcs"))
|
||||
(prettier . (npx "prettier" "--stdin-filepath" filepath))
|
||||
(shfmt . ("shfmt"))
|
||||
(rustfmt . ("rustfmt" "--quiet" "--emit" "stdout"))
|
||||
(terraform . ("terraform" "fmt" "-")))
|
||||
"Alist of code formatting commands.
|
||||
|
@ -1065,6 +1066,7 @@ function: %s" command)))
|
|||
(rustic-mode . rustfmt)
|
||||
(rust-mode . rustfmt)
|
||||
(sass-mode . prettier)
|
||||
(sh-mode . shfmt)
|
||||
(terraform-mode . terraform)
|
||||
(TeX-latex-mode . latexindent)
|
||||
(TeX-mode . latexindent)
|
||||
|
|
|
@ -4,7 +4,7 @@ set -euxo pipefail
|
|||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install -y curl gnupg lsb-release
|
||||
apt-get install -y ca-certificates curl gnupg lsb-release
|
||||
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
||||
|
||||
|
|
21
test/formatters/installers/shfmt.bash
Normal file
21
test/formatters/installers/shfmt.bash
Normal file
|
@ -0,0 +1,21 @@
|
|||
ver="$(latest_release mvdan/sh)"
|
||||
|
||||
arch="$(uname -m)"
|
||||
case "${arch}" in
|
||||
"x86_64")
|
||||
arch="amd64"
|
||||
;;
|
||||
"i386")
|
||||
arch="386"
|
||||
;;
|
||||
"aarch64")
|
||||
arch="arm64"
|
||||
;;
|
||||
*)
|
||||
echo >&2 "unsupported architecture: ${arch}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
wget "https://github.com/mvdan/sh/releases/download/${ver}/shfmt_${ver}_linux_${arch}" -O /usr/local/bin/shfmt
|
||||
chmod +x /usr/local/bin/shfmt
|
2
test/formatters/samplecode/shfmt/in.bash
Normal file
2
test/formatters/samplecode/shfmt/in.bash
Normal file
|
@ -0,0 +1,2 @@
|
|||
function f(){
|
||||
thing;}
|
3
test/formatters/samplecode/shfmt/out.bash
Normal file
3
test/formatters/samplecode/shfmt/out.bash
Normal file
|
@ -0,0 +1,3 @@
|
|||
function f() {
|
||||
thing
|
||||
}
|
Loading…
Add table
Reference in a new issue