Skip to content

Getting Started

gruft is a unified formatter (linter coming soon) that supports 25+ languages and markups. It is designed to be fast, easy to use, and requires minimal configuration.

Installation

The CLI is compatible with macOS, Linux, and Windows. You can install it using the following methods:

sh
curl -fsSL https://gruft.dev/install.sh | sh
powershell
pwsh -Command "irm https://gruft.dev/install.ps1 | iex"

After installation, verify it by running gruft version in your terminal.

If you encounter command not found errors after installation, you may need to add the installation directory (~/.gruft/bin) to your PATH.

Add installation to PATH

Run the following command to add the installation directory to your PATH or copy the appropriate exports to your shell configuration file.

sh
echo 'export PATH="$HOME/.gruft/bin:$PATH"' >> ~/.bashrc
sh
echo 'export PATH="$HOME/.gruft/bin:$PATH"' >> ~/.zshrc
sh
fish_add_path $HOME/.gruft/bin
powershell
$User = [EnvironmentVariableTarget]::User
$Path = [Environment]::GetEnvironmentVariable('Path', $User)
$InstallDir = "$HOME\.gruft\bin"
if (!(";$Path;".ToLower() -like "*;$BinDir;*".ToLower())) {
  [Environment]::SetEnvironmentVariable('Path', "$Path;$InstallDir", $User)
  # Persist the PATH variable across sessions 
  $env:Path += ";$InstallDir"
}

TIP

The CLI supports macOS (arm64 and x86_64), Linux (x86_64), and Windows (x86_64) architectures.

For additional installation methods, see Installation.

Configuration

To configure gruft for your project, create a gruft.toml file in the root of your project.

sh
gruft init

TIP

For more information on configuration options, see the init command documentation.

Usage

Currently, formatting is the only supported operation (linting coming soon). To format your project, run the following command in your project directory:

sh
gruft format <files>

You can run this command anywhere in your project and it will recursively search for gruft.toml files in parent directories until it encounters a configuration file with root: true set. If --no-config is set, it will use the default configuration and run from the current working directory.