Zola: Feature request: Allow `gutenberg init` or `gutenberg init .` to work on its own inside an empty directory

Created on 8 Sep 2018  Â·  7Comments  Â·  Source: getzola/zola

I've been looking at gutenberg and just tried to create one, and my first two attempts were:

  • Creating an empty folder and trying to init inside it with gutenberg init
  • When that didn't work, trying to do gutenberg init .

I'm not entirely set on the former working, but I feel that the latter should, which means changing the check to only allow directories that don't exist, to also allow directories that are empty.

I'm willing to implement this, but I've got interface questions:

  • Should a bare gutenberg init initialize the current directory?
  • What should the error messages be for directories that already exist, and aren't empty?
enhancement good first issue help wanted

Most helpful comment

I just started with zola and it was the first issue I ran into. It's surprising that zola init in an empty directory does not just use that directory to initialize. Both cargo init and git init behave that way.

All 7 comments

First bullet point is definitely a no.
Second one I'm not really convinced.

Trying to run gutenberg init I get:

~/Code/gutenberg(branch:next) » gutenberg init                vincent@arch
error: The following required arguments were not provided:
    <name>

USAGE:
    gutenberg init <name>

. is not a name so that would introduce 2 meanings for the argument to init: a name or current dir. Also, as you mention, it's not really obvious what should be done if the directory is not empty.

I would not change anything for now but I'll leave the issue open for discussion.

I just started with zola and it was the first issue I ran into. It's surprising that zola init in an empty directory does not just use that directory to initialize. Both cargo init and git init behave that way.

I didn't know cargo init worked without a name. I just tried it in my random folder and sure enough it created all the files/folders, except I already had a src folder and it just added a main.rs in it.

Maybe if the name is not mentioned, add an additional prompt asking if they want to create it in the current directory?

Maybe if the name is not mentioned, add an additional prompt asking if they want to create it in the current directory?

From a UX perspective I would prefer a "don't make me think approach" by default. I expect zola init to silently create a minimal, runable example that runs with zola serve. However, I do not expect the configuration to be fully done (in particular the site URL). If I see a "config.toml" I know I will have to tweak that.

If you want to provide a prompt, I would only do it when invoked from a folder that has "more than the usual suspects inside":

  • folder is empty, or contains only "dotfiles" -> just init, pick dummy name for site as "folder.com"
  • folder contains non-dot files -> prompt.

I'm ok with the two bullet points!

Anyone interested in implementing that?

Just ran into this too — I had the same expectation from zola init when trying to convert an existing purely HTML/CSS site into a templated one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seanomlor picture seanomlor  Â·  4Comments

phil-opp picture phil-opp  Â·  6Comments

pandark picture pandark  Â·  3Comments

codesections picture codesections  Â·  5Comments

nikhiljha picture nikhiljha  Â·  5Comments