Hugo

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] / post.md 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/post.md 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 https://gohugo.io/commands/hugo_gen_autocomplete/ but as long as I understand the created bash_completion.d script, it doesn’t handles archetypes autocomplete.

Does this idea feel right?

2 Likes

@anthonyfok is the expert in this area …

1 Like