Archetypes autocomplete in terminal

Is there a way to implement autocomplete of archetypes paths in terminal on a per-project basis?

So that I can do hugo new [tab=cycles through archetypes] / [tab=cycles through sections/subsections tree] / to create content. That would be very convenient in the long run when you have nested sections/subsections which are long to write. Sure a simple hugo new posts/ is not so long to write, but even then autocomplete would still feel good. For now it feels more practical to create content with some mouse clicks and snippets, but it’s a shame because Hugo offers those good ol archetypes for use.

For now autocomplete only works for “standard path” at project root (hugo new content/...) but then it uses Hugo’s default archetype, not the one set for the desired path/content. I had a look at but as long as I understand the created bash_completion.d script, it doesn’t handles archetypes autocomplete.

Does this idea feel right?


@anthonyfok is the expert in this area …

1 Like

I’ve added a Hugo spec to the Fig autocompletion project that might help if anyone might still be looking for a solution. Here’s a screen recording showing it being used and navigating an auto-populated list of archetypes using the arrow keys after using the -k flag:

Fig notes… Currently it’s macOS only, and if you sign up for an early access invite then join their Discord and intro yourself you should get an invite link (that’s what worked for me). Also after intstalling I’d recommend going into the Fig menu > Settings panel and searching for ‘width’ and ‘height’ to make the autocompletions window bigger. The Hugo Fig spec is here if anyone wants to submit updates.