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

Aperta
#3,348 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Ambito
cli

Direzione di ricerca

Start with the hbx dev and hbx build command entry points and reproduce the failure using --buildDrafts, then inspect how command-line arguments are parsed before Hugo is invoked. Done means the documented [hugoArgs...] behavior is consistent: Hugo arguments are accepted and forwarded, or the required -- separator and limitation are documented clearly.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

needs triage
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

Lingua principale
HTML
Stelle
9.8k
Fork
2.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di HugoBlox/kit

Tutte le issue di HugoBlox/kit

Issue simili

Altre issue su CLI

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.