envdoc icon indicating copy to clipboard operation
envdoc copied to clipboard

Multiple source files support

Open g4s8 opened this issue 1 year ago • 2 comments

According to multiple requests, it's important to support generating doc from config types located in different files. It could be done by defining a new CLI flag -project pointing to project root location. Starting from the project root envdoc can parse all project files and collect them in file-set. Then, AST parser should parse the file-set with multiple files, and keep a new context about current package and file. Also, AST parser has to use this context to collect and resolve config types and its relations. Output document could be extended by multiple new related config types.

Open questions:

  • Do we need primary config type? Support -type param with -project?
  • Documentation resolver issues?
  • CLI flag conflicts?

Breakdown:

  • [ ] Keep package and file context with AST type
  • [x] Resolve documentation for each package separately
  • [ ] Pay attention to type package name when building types relations
  • [ ] Add -project flag and parse file-set from dir if the flag specified

Related tickets:

  • #20
  • #16
  • #15

g4s8 avatar May 08 '24 22:05 g4s8

As an alternative, would it be possible to support finding the project root by going up until we find a go.mod file similar to git and the .git directory?

miniscruff avatar May 08 '24 23:05 miniscruff

Thanks, it's a good idea. But I think it's still needed to have an option to specify base dir because there was a request to parse all files with types from current dir, not from the whole project (e.g. config package). So it could be done like:

  • -base-dir - find go.mod
  • -base-dir=. - get files from the current dir

g4s8 avatar May 09 '24 06:05 g4s8