Visitar URL original
shfmt Plugin - dprint - Code Formatter
// plugins

shfmt

shfmt (shell script) wrapper plugin.

Wrapper plugin that formats shell scripts via shfmt. It runs shfmt's own code compiled to Wasm, so it formats exactly like the shfmt CLI.

Formats .sh, .bash, .mksh, .bats, and .zsh files, along with shell dotfiles such as .bashrc, .bash_profile, .zshrc, and .zshenv. POSIX shell, Bash, mksh, Bats, and Zsh are supported.

See also the Shuck plugin, which formats shell scripts with shuck-formatter, a separate implementation in Rust.

Install and Setup

In your project's directory with a dprint.json file, run:

dprint add shfmt

This will update your config file to have an entry for the plugin. Then optionally specify a "shfmt" property to add configuration:

{
  "shfmt": {
    // shfmt's config goes here
  },
  "plugins": [
    "npm:@dprint/shfmt@0.2.0"
  ]
}

All plugins

Official Plugins

Community Plugins

Wrapper Plugins

Everything Else