I don’t know if this is on the roadmap but I’d like to encourage documenting and exposing the Pkg.generate
API for programmatic usage. Recently I’ve been working on adding a plugins interface for Genie
, and part of it I provide a scaffolding method. A plugin is a Julia package with some Genie
interfaces - so scaffolding involves creating this Julia package and then setting up some files and a certain folder structure within the package.
However, without a clear API it’s hard to make progress and I don’t want to hack things at file level as that’s brittle and undocumented and can break with changes in Pkg
. For instance:
-
I run
Pkg.generate("$user_provided_plugin_name")
- how do I programatically retrieve the name of the module and the location of the generated file(s) (what if the user inputs spaces, dashes, casing, etc.)? -
I would like to pre-populate the generated
module
file with the interfaces to help the devs. A newly generated module within a package now has agreet()
method and a closingend # module
line. I could search for either of these and write my code around them - but these could change at any time, breaking my code.
What’s the best way to solve these problems?
I’ve been looking at PackageSpec
but it doesn’t appear to work with Pkg.generate
? Also, PackageSpec
would have to support a user inputted template instead of the default greet()
.