Documentation previewThese docs are actively being built. Some pages may change as the framework and examples are finalized.
Skip to content

Opening Generated Files

File-generating make commands can open the primary generated file in your editor after the command succeeds.

Use --open or -o when you want the file opened for this run:

bash
forj make:controller users --open
forj make:job reports:daily -o

For a named app, use the same flag after the app prefix:

bash
forj marketplace make:controller checkout --open

Use --no-open when you want to suppress editor opening for this run, even if the App is configured to open generated files automatically:

bash
forj make:command reports:sync --no-open

Supported Commands

The editor hook is available on make commands that create an editable source file:

CommandFile opened
make:controllergenerated controller file
make:commandgenerated command file
make:eventgenerated event file
make:subscribergenerated subscriber file
make:jobgenerated job file
make:schedulegenerated schedule file
make:modelgenerated model file
make:migrationfirst generated up migration

make:queue does not use the editor hook because it updates queue configuration instead of creating an editable source file.

Automatic Opening

Generated Apps include:

dotenv
FORJ_MAKE_OPEN=auto
FORJ_EDITOR=

FORJ_MAKE_OPEN controls whether make commands try to open generated files.

ValueBehavior
autoOpen when the command is running in an interactive terminal and not in CI.
alwaysAlways try to open after a successful generator run.
neverNever open unless the command uses --open or -o.

In auto, GoForj only opens when stdin and stdout are attached to a terminal and CI is not set to a truthy value. This keeps scripts and CI jobs quiet.

If automatic opening cannot find an editor, it silently does nothing. If you explicitly pass --open or set FORJ_MAKE_OPEN=always, GoForj prints a warning when no editor can be resolved.

Editor Resolution

Set FORJ_EDITOR when you want a specific editor command:

dotenv
FORJ_EDITOR="code --reuse-window --goto {location}"
FORJ_EDITOR="goland --line {line} {file}"

Supported placeholders:

PlaceholderValue
{file}Absolute generated file path.
{line}Line number to open.
{location}Absolute file path plus line, such as /path/to/file.go:1.

When FORJ_EDITOR is empty, GoForj tries to infer the editor in this order:

  1. Terminal hints, such as Cursor, VS Code, Zed, or a JetBrains terminal.
  2. Already-running GUI editor processes.
  3. Editor commands available on PATH.

The editor priority is:

  1. GoLand
  2. Cursor
  3. VS Code
  4. Zed
  5. IntelliJ IDEA

GoForj prefers a running editor before launching a different editor from PATH.