Help us shape the future of Go! Take the 2026 Go Developer Survey

fmtcmd

package
v1.65.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package fmtcmd checks and formats web code with Oxfmt using the shared Garcia Ventures style (@gv-tech/oxc-config), without requiring a local install.

Index

Constants

This section is empty.

Variables

View Source
var FmtCmd = &cobra.Command{
	Use:   "fmt [path]",
	Short: "Check or format code with Oxfmt using @gv-tech/oxc-config style",
	Long: `Check or format a file or directory with Oxfmt using the shared
@gv-tech/oxc-config style, without requiring a local install.

By default (and with --check) it verifies formatting: it lists files that
would change and exits non-zero when the workspace is dirty, without
modifying anything. Pass --write to format files in place, or --diff to
also show a colored unified-style diff of the pending changes.

The formatter runs through the gv-oxfmt wrapper (bun in bun workspaces,
npx otherwise) so the shared style applies even without a local install. A
local oxfmt binary is only used as a last resort, or when forced with
--runner oxfmt. Use --config to format with a custom oxfmt config instead.

This formats JS/TS and web assets (the Oxfmt domain); Go code is formatted
with gofmt via 'task format'.`,
	Example: `  eng fmt
  eng fmt ./web
  eng fmt src/index.ts --diff
  eng fmt --write .
  eng fmt --write src --runner bun
  eng fmt --check .`,
	Args: cobra.MaximumNArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		headerStyle := lipgloss.NewStyle().
			Bold(true).
			Foreground(theme.Primary).
			MarginBottom(1)
		if !ui.DisableProgress {
			fmt.Fprintln(log.Out, headerStyle.Render("✨ Oxfmt Code Formatter"))
		}

		target := "."
		if len(args) > 0 {
			target = args[0]
		}
		opts := oxfmt.Options{
			Path:       target,
			Write:      fmtWrite,
			Check:      fmtCheck,
			Diff:       fmtDiff,
			Runner:     fmtRunner,
			ConfigPath: fmtConfig,
			IsVerbose:  cmdutil.IsVerbose(cmd),
		}
		ctx := cmd.Context()
		if ctx == nil {
			ctx = cmdutil.FallbackContext()
		}
		return oxfmt.Run(ctx, opts, nil)
	},
}

FmtCmd checks or formats a file or directory with Oxfmt using the @gv-tech/oxc-config style.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL