hof / fmt

hof/fmt is a command which will format any and all languages. You can create your own formatters as well.

hof needs a code formatter for the languages it generates. It runs the pre-output through before applying diff and merging with any custom code you added to output files. This is simplifies the job of template authors, but is also required to avoid unnecessary merge conflicts.

You will need Docker available to use this feature. Hof will pull and run containers in the background. You can disable this by setting an environment variable.


$ hof help fmt

With hof fmt, you can
  1. format any language from a single tool
  2. run formatters as api servers for IDEs and hof
  3. manage the underlying formatter containers

  hof fmt [filepaths or globs] [flags]
  hof fmt [command]

Available Commands:
  info        get formatter info
  pull        docker pull a formatter
  start       start a formatter
  stop        stop a formatter

  -d, --data   include cue,yaml,json,toml,xml files, set to false to disable (default true)
  -h, --help   help for fmt

Global Flags:
      --inject-env       inject all ENV VARs as default tag vars
  -p, --package string   the Cue package context to use during execution
  -q, --quiet            turn off output and assume defaults at prompts
  -t, --tags strings     @tags() to be injected into CUE code
  -v, --verbosity int    set the verbosity of output

Use "hof fmt [command] --help" for more information about a command.
2023 Hofstadter, Inc