GioJSdocs
On this page

gio help

Print the gio command list or one command's options; gio --version prints the CLI, server binary and @gio.js/core versions.

bash
gio help [command]
gio --help                # -h
gio <command> --help      # same as gio help <command>
gio --version             # -v

Reference

ParameterTypeDefaultDescription
[command]string-A command name (dev, cache, ...). Without it, the command list. An unknown name is a usage error.

Behavior

text
$ gio --help
Usage: gio <command> [options]

Commands:
  dev      Start the development server (file watcher, error overlay)
  start    Start the production server
  build    Explain deploys; `gio build standalone` packages a deploy directory
  export   Render the app to static HTML in out/
  routes   List the app's routes (pages, route handlers, WebSockets, metadata)
  typegen  Write .gio/routes.d.ts (typed routes) without starting the server
  doctor   Check the environment and project for problems
  info     Print versions and environment details for bug reports
  cache    Explain how the cache served a URL (`gio cache explain <url>`)
  bench    Load-test a running server
  migrate  Migrate a Next.js app to GioJS (runs create-giojs migrate)
  add      Add a feature to this app (runs create-giojs add)
  help     Show help for a command

Options:
  -h, --help       show help (also: gio help <command>, gio <command> --help)
  -v, --version    show the CLI, server binary and @gio.js/core versions

Exit codes:
  0  success
  1  the command failed (server exited with an error, doctor found errors,
     no server binary, route conflict, ...)
  2  usage error (unknown command or option, missing argument)

Docs: https://giojs.com/docs/cli
  • gio help and gio --help print to stdout and exit with 0. gio with no command prints the same text to stderr, adds To start the server: gio dev (development) or gio start (production)., and exits with 2.
  • gio help <command> prints the command's usage, summary and options. For migrate, add and build standalone, the command's own --help has the full option list (the first two come from create-giojs).
  • Anything more is a usage error, exit 2: gio help dev extra, gio --help dev (it suggests gio help dev), gio --version --bogus, or an unknown name in gio help <command>.

gio --version

Prints three lines and exits with 0, even when no binary is installed (not installed (...)). Each version is a package version, read from the installed package.json: gio is @gio.js/server's, the server binary is its platform package's (@gio.js/server-<platform>), and @gio.js/core is the installed package's. The binary is never run to ask. A binary from GIO_SERVER_BIN or a repository build has no package, so its line shows where it came from and its path instead of a version.

text
$ gio --version
gio            0.1.0-beta.8 (@gio.js/server)
server binary  0.1.0-beta.8 (@gio.js/server-darwin-arm64)
@gio.js/core   0.1.0-beta.8

Exit codes

CodeMeaning
0Success.
1The command failed: the server exited with an error (its own code is passed through), gio doctor found an error, no server binary, a route conflict, an unreachable server.
2Usage error: unknown command or option, a missing or malformed argument.

Commands that run their own parser keep the same codes: gio build standalone, gio bench, gio migrate and gio add exit with 2 for a usage error, before doing anything.

Examples

A mistyped command

text
$ gio strat
gio: unknown command "strat" - did you mean `gio start`?
Run `gio --help` for usage.

Close misspellings and unambiguous prefixes (gio doc) get a suggestion. Words people type out of habit get a pointer:

You typeSuggested
gio serve, gio rungio start
gio create, gio new, gio initnpm create giojs@latest
gio versiongio --version
gio lintyour linter directly (GioJS has no lint command)

One command's options

text
$ gio help cache
Usage: gio cache explain <url-or-path> [--base <url>]

Explain how the cache served a URL (`gio cache explain <url>`).

Requests the URL from the running server and decodes its X-Gio-Cache
header: hit, stale (revalidating), miss; stored, bypass, static or ppr.
...

Good to know

  • Every command parses its options strictly: an unknown option is an error with a suggestion, never ignored, and a bare gio never starts a server.
  • Help text loads nothing else, so gio --help answers instantly even in a broken install.

Version history

VersionChanges
v0.1.0-beta.8Introduced: gio help, --help on every command, --version, did-you-mean errors and exit code 2 for usage errors, in every command. A bare gio prints the help instead of starting the server.