Just a quick thought... It might be helpful to have a build command/alias such that hugo build == hugo.
For example, in a Dockerfile (like the current one) where the default command is --help, there doesn't seem to be an easy way to unset that to null and just run plain old hugo 鈥斅爐he expected behavior is to be able to override the command to something like build at runtime (like we'd do for server or version). I'm sure there are some other (likely CI/automation related) cases where this might be helpful.
To be clear I consider this a limitation with Docker and not Hugo, but I've had this on my wishlist for a while now and I'm curious to hear any thoughts. Apologies for not having enough familiarity to make an actual PR, I poked around in commands/ for a bit and if others think this is a good idea I can spend some more time, I'm guessing it'd be fairly trivial. Feel free to close this if not, though! :)
That sounds like an odd thing from Docker -- but it shouldn't cost us too much, and I can imagine other tools that also would like to have the symmetry of "hugo subcommand" for everything.
Hi! I wished to work on this issue.
I was thinking that one way of solving this could be writing a function for the commandsBuilder type which returns a hugoCmd type. It would have the following in the RunE:
hugoCmd := b.newHugoCmd().getCommand()
return hugoCmd.RunE(cmd, args)
The new function could be placed in a new file named build.go in the commands directory.
Would love thoughts about this approach.
Given a configuration like this:
ENTRYPOINT ["hugo"]
CMD ["--help"]
I think it is possible to replace --help with "blank" by using the following in a new Dockerfile:
```Dockerfile
FROM .../hugo
CMD []
````
On the other side are there Docker images out there where command is not provided and build works as it should.
@BaibhaVatsa I was hoping that Cobra would handle this via its Aliases, but looking at it now you cannot refer to its parent. I need to think about this.
Most helpful comment
That sounds like an odd thing from Docker -- but it shouldn't cost us too much, and I can imagine other tools that also would like to have the symmetry of "hugo subcommand" for everything.