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

#3348 ยท open ยท 1 comments

View on GitHub โ†—

AliSajid

### Preliminary Checks - [x] This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/HugoBlox/kit/issues?q=is%3Aissue - [x] This issue is not a question, feature request, or anything other than a bug report directly related to HugoBlox Kit. Please post those things on Discord: https://discord.gg/z8wNYzb ### 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: ```console $ 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: ```console hbx dev --buildDrafts ``` should behave equivalently to: ```console hugo server --disableFastRender --buildDrafts ``` Similarly: ```console hbx build --buildDrafts ``` should behave equivalently to: ```console hugo --gc --minify --buildDrafts ``` Alternatively, if Hugo arguments must be separated using `--`, the following should work and the requirement should be documented clearly: ```console 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. ```text error: unknown option '--buildDrafts' ``` ## Relevant help output The help text for `hbx dev` documents a variadic `hugoArgs` argument: ```text 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`: ```text 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: ```console 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: ```console hbx dev --buildDrafts ``` 3. Observe that the CLI exits with: ```text 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: ```console hbx dev --buildDrafts ``` should behave equivalently to: ```console hugo server --disableFastRender --buildDrafts ``` Similarly: ```console hbx build --buildDrafts ``` should behave equivalently to: ```console hugo --gc --minify --buildDrafts ``` ### Actual Result ```console $ 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? ```go 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

Comments

github-actions[bot]

Hey, thanks for your first issue! ๐Ÿš€ Your feedback is vital for improving the project for everyone. Feeling empowered? Squashing this bug yourself could be a great first open-source contribution! We're here to help you. Here's our [Contributor Guide](https://github.com/HugoBlox/kit/blob/main/CONTRIBUTING.md). Let's connect on [Discord](https://discord.gg/z8wNYzb) to chat about it. We've got a super helpful community!