Skip to content

hbx dev and hbx build reject additional Hugo arguments despite documenting [hugoArgs...] #3348

Description

@AliSajid

Preliminary Checks

Description

Summary

The HugoBlox CLI documentation for hbx dev and hbx build indicates that both commands accept additional positional arguments through [hugoArgs...]. These arguments appear intended to be forwarded to the underlying hugo server or hugo command.

However, Hugo flags passed through hbx are currently rejected as unknown HugoBlox CLI options.

For example, attempting to include drafts in the development server fails:

$ hbx dev --buildDrafts

👋 Welcome to the Early Access / Preview Edition of HugoBlox CLI!
   We'd love your feedback on our Discord: https://hugoblox.com/discord
   Report issues: https://github.com/HugoBlox/kit/issues

error: unknown option '--buildDrafts'

Expected behavior

Arguments not handled directly by HugoBlox CLI should be forwarded to the underlying Hugo command.

For example:

hbx dev --buildDrafts

should behave equivalently to:

hugo server --disableFastRender --buildDrafts

Similarly:

hbx build --buildDrafts

should behave equivalently to:

hugo --gc --minify --buildDrafts

Alternatively, if Hugo arguments must be separated using --, the following should work and the requirement should be documented clearly:

hbx dev -- --buildDrafts
hbx build -- --buildDrafts

Actual behavior

Hugo options beginning with - or -- are parsed as HugoBlox CLI options and rejected before they can be forwarded to Hugo.

error: unknown option '--buildDrafts'

Relevant help output

The help text for hbx dev documents a variadic hugoArgs argument:

Usage: hbx dev [options] [hugoArgs...]

Start the Hugo development server (hugo server)

Options:
  --path <dir>        Project directory (defaults to cwd)
  --no-default-flags  Disable automatic --disableFastRender flag
  --quiet             Suppress all output except errors
  --filter            Show only warnings and errors (hide info messages)
  --verbose           Show all Hugo output (default)
  -h, --help          display help for command

The same is true for hbx build:

Usage: hbx build [options] [hugoArgs...]

Run a production Hugo build (hugo --gc --minify)

Options:
  --path <dir>        Project directory (defaults to cwd)
  --no-default-flags  Disable automatic --gc/--minify flags
  --quiet             Suppress all output except errors
  --filter            Show only warnings and errors (hide info messages)
  -h, --help          display help for command

This makes it appear that arbitrary Hugo arguments are supported, but the current option parsing prevents commonly used Hugo flags from being passed.

Suggested resolution

One of the following would resolve the ambiguity:

  1. Allow unknown options after the command name to be captured in [hugoArgs...] and forwarded to Hugo.
  2. Support forwarding arguments after the conventional -- separator.
  3. If forwarding Hugo flags is not supported, remove [hugoArgs...] from the usage text and document the limitation.

Supporting -- would likely provide the clearest distinction between HugoBlox CLI options and options intended for Hugo:

hbx dev --path ./site -- --buildDrafts --buildFuture

Reproduction Link

https://github.com/AliSajid/hugoblox-cli-args-reprex

Steps to Reproduce

Steps to reproduce

  1. Open a HugoBlox project.

  2. Run:

    hbx dev --buildDrafts
  3. Observe that the CLI exits with:

    error: unknown option '--buildDrafts'
    

The same issue appears to affect hbx build when passing options intended for the underlying Hugo command.

Expected Result

Expected behavior

Arguments not handled directly by HugoBlox CLI should be forwarded to the underlying Hugo command.
For example:

hbx dev --buildDrafts

should behave equivalently to:

hugo server --disableFastRender --buildDrafts

Similarly:

hbx build --buildDrafts

should behave equivalently to:

hugo --gc --minify --buildDrafts

Actual Result

$ hbx dev --buildDrafts

👋 Welcome to the Early Access / Preview Edition of HugoBlox CLI!
   We'd love your feedback on our Discord: https://hugoblox.com/discord
   Report issues: https://github.com/HugoBlox/kit/issues

error: unknown option '--buildDrafts'

What Hugo Module versions does your site use?

module github.com/HugoBlox/kit/templates/starter

go 1.19

require github.com/HugoBlox/kit/modules/blox v0.12.0

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

No response

Which Hugo Blox template are you using?

Starter for the reprex repo. Independent of template.

What version of Hugo are you using?

hugo v0.159.2-5f4646acaad89e1166aac118e118b0d28013f460+extended darwin/arm64 BuildDate=2026-04-01T12:59:20Z VendorInfo=gohugoio

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions