Configuration file for the command line
Wouldn't it be nice to have a simple configuration file to configure default behavior of the command line?
For instance, it could be a JSON file (to avoid introducing new dependencies), located in a standard (system dependent) place, e.g. ~/.golorc, where default values for the command line options of the golo command could be overridden.
Rough sample file:
{
"compile": {
"output": "build"},
"doc": {
"format": "markdown",
"output": "build/doc"},
"golo": {
"classpath": ["~/opt/mylib.jar", "/usr/share/java/useful.jar"]},
"new": {
"type": "gradle"}
}
A project specific file could also be defined, which would override the defaults and the values defined in ~/.golorc (e.g. to define default --files and --module values).
For instance, in MyProject/.golorc:
{
"golo": {
"classpath": ["libs/additional.jar"],
"files": ["src/foo.golo", "src/bar.golo", "src/main.golo"],
"module": "MyProject"}
}
(relative files resolved with the base directory of the golorc they pertains, or relative to the directory the command is run, to be defined)
thus running a simple golo golo in MyProject would be equivalent to run
golo golo --classpath ~/opt/mylib.jar:/usr/share/java/useful.jar:./libs/additional.jar --files src/foo.golo src/bar.golo src/main.golo --module MyProject
and golo doc would result in
golo doc --format markdown --output ./build/doc
A additional command line may be added to specify an alternate configuration file.
The purpose is not to replace a full featured build management (mvn, gradle), but to make long command lines shorter.
Sounds like a worthy idea to explore.
Maybe a property file would be more convenient than JSON (it's Java ecosystem after all).