-
Notifications
You must be signed in to change notification settings - Fork 116
Description
For commands like fpm doc or fpm fmt the available pool of tools is quite large and heterogeneous, if we want to support such functionality it must allow some kind of customization
A non-comprehensive list of tools for fpm doc:
- doxygen
- requires
Doxyfileas input
- requires
- ford
- markdown file with yaml header as input, can have any name
- ufpp
- actually a preprocessor which can also extract documentation
For fpm fmt:
- lfortran fmt
- actually an LLVM compiler + formatting
- findent
- can only take stdin and only writes to stdout
- fprettify
- can recursively run over the source tree
All of those tools come with specific requirements and limitations. Also, I doubt there would be a perfect choice we could all agree on for those functionalities. One possibility is to collect all common tools and add native support for them in fpm, which might be cumbersome and if one has a personal set of tools for this task, they cannot use it with fpm in an automated way.
My proposal it to allow defining those functions as “plugins” instead:
[plugin]
[plugin.fmt] # Adds `fmt` command to fpm
program = "lfortran"
# Special variables like @INPUT@ and @OUTPUT@ are replaced by the filenames
command = ["fmt", "--no-color", "@INPUT@"]
# Standard input and standard output can be captured if necessary
output.capture = true
# Probably needs a better way to define the interaction with the source...
scope = ["src/", "app/"]Those could be defined locally in a fpm.toml, globally in a .fpmrc.toml or fetched like any other package. Note that installing the actual tool would be in many cases beyond the scope of fpm.