Crystal init is confusing

As a note, after running crystal init, it creates a “main” file, ex:

# TODO: Write documentation for `TempDb`
module TempDb
  VERSION = "0.1.0"

  # TODO: Put your code here
end

This is actually fairly confusing. Am I supposed to add code there, like 3+3? How do I then run it? It would be nice to make this more clear somehow…

One way: put “Put your code here” below the module. Another way: have it create an initial method that gets called below the module. I’m sure there are other ways. I just am kind of missing the simplicity of “here’s a file, you just run it” which feels gone…peace!

3 Likes

I would simply remove those TODOs

4 Likes

Semi-related note, I still get confused by crystal init lib vs crystal init app. I wish there was one crystal init command with an option for adding a CLI target (aka an app).

1 Like

The only difference is shard.lock is in .gitignore in a lib but not an app. Doesn’t have anything to do with CLI targets.

3 Likes