Menu
Open source
The fmt command
The fmt
command formats a given Alloy configuration file.
Usage
Usage:
shell
alloy fmt [<FLAG> ...] <FILE_NAME>
Replace the following:
<FLAG>
: One or more flags that define the input and output of the command.<FILE_NAME>
: The Alloy configuration file.
If the <FILE_NAME>
argument isn’t provided or if the <FILE_NAME>
argument is equal to -
, fmt
formats the contents of standard input.
Otherwise, fmt
reads and formats the file from disk specified by the argument.
The --write
flag can be specified to replace the contents of the original file on disk with the formatted results.
--write
can only be provided when fmt
isn’t reading from standard input.
The command fails if the file being formatted has syntactically incorrect Alloy configuration, but doesn’t validate whether Alloy components are configured properly.
The following flags are supported:
--write
,-w
: Write the formatted file back to disk when not reading from standard input.
Was this page helpful?
Related documentation
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video
Intro to Kubernetes monitoring in Grafana Cloud
In this webinar you’ll learn how Grafana offers developers and SREs a simple and quick-to-value solution for monitoring their Kubernetes infrastructure.
Video
Optimizing Kubernetes Operations with Grafana Cloud
Join us for an insightful Grafana Cloud webinar dedicated to advanced Kubernetes monitoring techniques.
Video
Incident management with Grafana IRM & SLOS in Grafana Cloud
This webinar shows you how to prioritize critical resources through service level objective(SLO)-driven incident response and management (IRM).